Install multiple versions of a package, each with its own binary

That looks like the real file conflict. Nix has detected that you have multiple packages which provide emacs.info.gz and stops, because it’s not possible to create an environment with those packages.

If you want to have both versions available without switching it in the configuration.nix, you will have to wrap one of them in a script…

Try to replace one of the packages with sth like this:

(wrieShellScriptBin "my-emacs" ''
   exec "${my-emacs}/bin/emacs" "$@"
'')

Then you can start it using my-emacs.

This avoids the collision because the derivation contains only a shell script, the rest of my-emacs is not brought into the environment directly

2 Likes