TL;DR. I am looking for a way to automatically activate versions of tools specified in .tool-versions
file. I use mise
today in my non-nix environment, but mise
doesn’t seem to work in NixOS the way I expect it to.
In essense, mise
is similar to asdf
.
Some of projects at work have a file called .tool-versions
.
Upon entering a folder containing .tool-versions
file, if a tool called mise
is installed on the system, the mise
automatically switches to use the versions of languages specified in .tool-versions
. Or it will suggests the tool versions are missing, in which case you can run mise install
to install them.
For example, if a given folder contains .tool-versions
with the following contents:
erlang 26.2.3
elixir 1.16.2-otp-26
…entering a folder will trigger mise
to automatically update PATH
(or do whatever it needs to do…) in order for binaries for both programming languages to become available.
The problem is, in mise
doesn’t seem to work in nixos
. At least in my practice. if I enter a folder containing .tool-versions
and run mise install
then I get an error:
Full error log
mise i
mise ⚠️ erlang is a community-developed plugin
mise url: https://github.com/asdf-vm/asdf-erlang
Would you like to install erlang? Yes
Downloading kerl...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 74085 100 74085 0 0 239k 0 --:--:-- --:--:-- --:--:-- 239k
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
100 101M 100 101M 0 0 41.0M 0 0:00:02 0:00:02 --:--:-- 54.4M
checking target system type... aarch64-unknown-linux-gnu
checking for gcc... no
checking for cc... no
checking for cl.exe... no
checking for clang... no
configure: error: in `/home/eugene/.local/share/mise/plugins/erlang/kerl-home/builds/asdf_26.2.3/otp_src_26.2.3/erts':
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details
ERROR: /home/eugene/.local/share/mise/plugins/erlang/kerl-home/builds/asdf_26.2.3/otp_src_26.2.3/erts/configure failed!
./configure: line 370: kill: (-204057) - No such process
mise ~/.local/share/mise/plugins/erlang/bin/install failed
Downloading kerl...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 74085 100 74085 0 0 239k 0 --:--:-- --:--:-- --:--:-- 239k
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
100 101M 100 101M 0 0 41.0M 0 0:00:02 0:00:02 --:--:-- 54.4M
checking target system type... aarch64-unknown-linux-gnu
checking for gcc... no
checking for cc... no
checking for cl.exe... no
checking for clang... no
configure: error: in `/home/eugene/.local/share/mise/plugins/erlang/kerl-home/builds/asdf_26.2.3/otp_src_26.2.3/erts':
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details
ERROR: /home/eugene/.local/share/mise/plugins/erlang/kerl-home/builds/asdf_26.2.3/otp_src_26.2.3/erts/configure failed!
./configure: line 370: kill: (-204057) - No such process
I believe the error is reasonable, because I don’t have any build utilities installed. After thinking more, trying to make mise
work could be dead-end, as to make it work I would have to make sure all build-time dependencies for Erlang and Elixir are installed…
I believe a different approach is needed. Something like:
- when I enter a directory which contains
.tool-versions
, - automatically, run a special nix shell that has necessary tool versions enabled
If “automatically” is not possible, I think I can settle on “run some nix dev env shell”. But I’ve never created a shell before. Any pointers as to how do I create a shell? I’d need a separate shell for each project, of which I have a several, each using its own set of language versions.
I am new to nix - any idea where to start with this?
P.S. .tool-versions
needs to stay, since all other team members are not planning to switch to nix.