Open abatilo opened 2 months ago
the trouble is people also need some env vars to be loaded before tools. I wonder if maybe we could use [env.post]
as a way to mark env vars that should be processed after tools are loaded or something.
another idea:
[env]
EXAMPLE = {value="{{exec(command='go version')}}", when="after_tools"}
Oh, that's an interesting idea. I hadn't considered the idea of putting hooks in with the env execution also but in hindsight it makes a lot of sense!
An example of where this would be helpful at my work:
We're using mise to manage our local development environments. We're using FoundationDB with some go bindings that are use cgo to wrap the FoundationDB client libraries. We have foundationdb in the tools
config section, and we're defining CGO_CPPFLAGS
and other CGO_xxx
environment variables in the env
config section. These are all dependent on the install path for foundationdb, e.g.: ~/.local/share/mise/installs/foundationdb/x.y.z
.
Right now we're using something like this:
[env]
# Needed for FoundationDB.
FDB_LOCATION = "{{exec(command='mise where foundationdb 2>/dev/null || true')}}"
CGO_CPPFLAGS = '-I{{ env.FDB_LOCATION }}/usr/local/include'
But it would be better if we could use something like
FDB_LOCATION = "{{tools(name='foundationdb').install_path}}"
or something like that.
Side note: Use of "{{exec(command='mise where ...')}}"
seems to cause a fork-bomb with 2024.6.0 (mise calling mise calling mise etc.), which didn't happen with 2024.5.2.
I'd love to be able to use
mise
installed tools to executeenv
exec templates.If I have the following example
.mise.toml
I'd hope that
EXAMPLE
would get populated with the output ofgo version
.Instead I see the following error:
I tried also using
mise exec
to execute the command but that didn't work either.