let provide ~run_program ~host ~install_path it =
let conda_env = get_conda_env install_path it.package in
let install_workflow =
install_tool ~run_program ~host ~install_path it in
let export_var =
match it.tool_type with
| `Application -> None
| `Library v ->
let path = install_workflow#product#shell_which in
Some KEDSL.Program.(shf "export %s=\"%s${%s:+:}${%s}\"" v path v v)
in
Machine.Tool.create it.definition
~ensure:install_workflow
~init:KEDSL.Program.(
(if it.requires_conda
then Conda.init_env ~conda_env ()
else sh "echo 'Does not need Conda'")
&& it.init_environment ~install_path
&& Opam.kcom ~root_name:(Opam.root_of_package it.package) ~install_path
(shf "eval $(%s)") "config env"
&& Option.value export_var ~default:(sh "echo 'No export var'")
)