Firefox unsupported on aarch64-darwin


I am running Nix on an M1 Macbook Pro, running macOS Monterey 12.0.1. When I run the following:

nix search nixpkgs#firefox-bin

I see the following results:

* legacyPackages.aarch64-darwin.firefox-bin (98.0.2)
  Mozilla Firefox, free web browser (binary package)

yet when I try to install, I get the following error:

$ nix profile install nixpkgs#firefox-bin
error: Package ‘firefox-bin-98.0.2’ in /nix/store/m2vv0bxfchzrjngx8wi0i7dhzb9q2g50-source/pkgs/applications/networking/browsers/firefox/wrapper.nix:349 is not supported on ‘aarch64-darwin’, refusing to evaluate.

       a) To temporarily allow packages that are unsupported for this system, you can use an environment variable
          for a single invocation of the nix tools.


        Note: For `nix shell`, `nix build`, `nix develop` or any other Nix 2.4+
        (Flake) command, `--impure` must be passed in order to read this
        environment variable.

       b) For `nixos-rebuild` you can set
         { nixpkgs.config.allowUnsupportedSystem = true; }
       in configuration.nix to override this.

       c) For `nix-env`, `nix-build`, `nix-shell` or any other Nix command you can add
         { allowUnsupportedSystem = true; }
       to ~/.config/nixpkgs/config.nix.
(use '--show-trace' to show detailed location information)

I’m a little confused - I assume that if the legacyPackages.aarch64-darwin.firefox-bin package appears in the search, the package exists and is therefore supported on my architecture. Is this package actually unsupported, or is this a bug? Am I missing some config option somewhere?

It’s not supported: nixpkgs/packages.nix at d89f18a17e51532ed5f4d45297b0ddf11e46b9c8 · NixOS/nixpkgs · GitHub

It’s showing up in the search because all derivations can be evaluated for all platforms, even if the resulting binaries/builds don’t work. Packages aren’t removed from the attrset just because they are broken.

After all, you wouldn’t be able to see that nice message telling you how to try it anyway if it didn’t exist.

That said, it is indeed a bit counter-intuitive. Perhaps nix search could also check if the package is supported/broken before showing it. OTOH, it’s also nice to see if a package exists, rather than just whether I can use it, so I know if I should try to package it myself. Figuring out if it’s unsupported isn’t that many more steps.

Maybe the nix search output could be enhanced to show a bit of the metadata instead?

This seems like a bug and I’d encourage you to report this behavior on the Nix bug tracker.

nix-env does not list packages that failed to evaluate for the desired platform.