Installing firefox and firefox-devedition side by side

Hi!
I have installed firefox by adding it to environment.systemPackages. Now I am trying to install firefox-devedition using nix-env -iA nixos.firefox-devedition-bin (I’m using nix-env for this since I want to eventually use the firefox nightly derivations from the mozilla overlay and don’t want to pollute environment.systemPackages with non-reproducible builds).

As expected this adds a symlink called firefox-devedition to ~/.nix-profile/bin/. However, it also adds a symlink called firefox to ~/.nix-profile/bin. This symlinks goes to /nix/store/c0na6v8n5fp51vgl3fv84vx6rhg094ws-firefox-devedition-bin-unwrapped-62.0b7/bin/firefox.

Now I’ve got two questions:

  1. Why does this happen? My understanding is that nix-env will only symlink the package that I actually tried to install but not its dependencies. However, in this case the firefox-devedition-bin-unwrapped dependency also seems to be symlinked, so my understanding must be wrong.
  2. How can I avoid this?
1 Like

Firefox wrapper adds unwrapped firefox to propagated-user-env-packages. These are the packages that are automatically installed when you install current one (either via nix-env or systemPackages).

Unfortunately, I can’t come up with an elegant way to opt out without breaking the firefox-devedition.

If you experience an issue accessing your old firefox, as a workaround, you could rename its binary to make it accessible. I do this for installing two firefoxes side by side (https://github.com/rasendubi/dotfiles/blob/master/README.org#firefox)

{ pkgs }:
{
  environment.systemPackages = [
    (pkgs.runCommand "firefox-old" { preferLocalBuild = true; } ''
      mkdir -p $out/bin
      ln -s ${pkgs.firefox}/bin/firefox $out/bin/firefox-old
    '')
  ];
}

(Note that you don’t need to install pkgs.firefox.)

Thank you @rasendubi! That perfectly explains why firefox ends up in my user environment and at least I have a workaround for installing both versions of firefox side by side.