I’m trying to install 2 versions of Emacs in my system:
The default Emacs package in nixpkgs
A locally cloned and modified Emacs
I have created an overlay for this, however, it still installs it as ‘emacs’.
How do I set it up such that each installation will have its own separate binary (emacs and emacs-localbuild)?
I have done similar things using mkShellScriptBin which just contains sth like exec ${experimentalEmacs}/bin/Emacs "$@", but it might be simpler to nix-build it and start it using ./bin/emacs
What I did was setup 2 Emacs overlays – 1st for the default package and the 2nd one for my locally built code.
Here’s the error being thrown, I’m guessing this is the fixup phase trying to move the Emacs Info files to /share.
error: collision between `/nix/store/y1kiwml5vajb9qcg543vg6s1af6i4wb2-emacs-localbuild/share/info/emacs.info.gz' and `/nix/store/kpbfkxqb4bjmvzn0had5w2m70x89n394-emacs-27.2/share/info/emacs.info.gz'
builder for '/nix/store/yam0y96a5ys8vm30aa1v9f9gly980zi9-home-manager-path.drv' failed with exit code 25
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: