Elixir: compilation warnings only in nix-shell -- ERL_LIBS

While trying out elixir in a nix-shell, running mix compile caused lots of compilation warnings:

$ nix-shell -p elixir
$ mix new foo
$ cd foo
$ mix compile
warning: this clause cannot match because a previous clause at line 1 always matches
warning: this clause cannot match because a previous clause at line 6 always matches

I’m running NixOS, so I tried adding elixir to my nixos config instead of using the nix-shell and the warnings disappeared. I compared env inside and outside the nix-shell and found that in the shell, the environment had set:


Since the above contains the same path twice, I tried removing the duplicate entry, but this made no difference.

Unsetting ERL_LIBS entirely, however, eliminated the warnings, and so far things seem to work as expected (I can run mix new , mix compile , and mix test without issue).

I don’t know enough about Elixir or Erlang to say whether this will break something else further down the line.

Does anyone know whether this is a reasonable workaround, or if there’s a better solution?


I encountered same warnings on macOS.

I got a hint from your unsetting ERL_LIBS and made my own nix user repository and it seems working.

Try my user repository https://github.com/jechol/nix-beam

1 Like