I have discovered Nix last month and I am currently on my way to migrating to it—both on macOS at home and the full NixOS distrubution at work. Now, I use it for configuration and package management, but I am considering to switch my development workflow to Nix too. Yet, I have some questions regarding the Elixir environment.
I am presently using
asdf to manage Erlang and Elixir versions. I like:
- its ease of use,
- the availability of many versions, including pre-releases and all patch versions,
- the way you can set a given version for each project thanks to
- automatic context switch between directories.
The only drawback I find now is the Erlang compilation dependencies management. I’ve set up an Elixir environment at work on several Linux distributions, and each time I missed some dependencies on the first run. I’m not even sure if I could manage to build Erlang using
asdf on NixOS since—as far as I understand—libraries are not available outside of a
nix-build. I have tried to do it in a
nix-shell, but it kept complaining about OpenSSL not being available, despite it being installed and set in
On the other hand, using Nix as part of my Elixir workflow could address these issues. As all build dependencies are automatically managed, there would not be Erlang build issues anymore. A simple
shell.nix in my projects would tell what is needed. From my first trials:
it is possible to set a given Erlang / Elixir version using a package like
shell.nixlets you tell other developers what’s exactly needed. It is even more powerful than
.tool-versionsas you can set other binary dependencies and try reproducibility thanks to
there is no automatic context switching. You can then forget to
nix-shelland use mistakenly a globally-installed Elixir version instead of the project one. Maybe it is just a habit to get used to, and frequent Nix users do this without thinking about it;
only the last patch version of each minor version is available, and it seems there are no pre-releases. This can be problematic, especially if you maintain libraries and want to test them on versions to come.
new versions seem to be available after a while compared to
In addition to these points, I think using Nix for projects is not as easy as
asdf when it comes to contributions:
asdf is easy to install at the user level and get into, where you need to
sudo to install Nix.
Are there some Nix / NixOS users here? What do you think about Nix in the Elixir workflow? How do you address the few points I have noticed? And if you are a NixOS user, how would you use
asdf if third-party project uses it?