Using multiple elixir/erlang versions from nixos

Have you tried following this post: Nix Flake Template for Elixir? - #5 by c4710n ? (And in particular this repository: GitHub - nix-giant/nix-dev-templates: A collection of Nix flake templates for development.)

You’ll have to enable flakes, but you can also do that temporarily by passing a cli argument as described here: https://nixos.wiki/wiki/flakes

I believe the following should work:

Inside your project directory run nix --experimental-features 'nix-command flakes' flake init --template github:c4710n/nix-dev-templates#elixir

Then you can change your version in flake.nix, you can search for available versions here: NixOS Search

Then run nix --experimental-features 'nix-command flakes' develop and you should have your version available.

I’m not sure about the enabling flakes temporarily part, so I hope that works.

Edit: It could be that the updated version is not picked up by nix because the old version is still in flake.lock, or when it’s not staged in git. I think I remember running into this at some point.

1 Like