Nix can't build aarch64-darwin Haskell binaries that don't require Nix?

I’m developing on aarch64-darwin using Nix flakes for my Haskell project.

It just occurred to me that there seems to be no way for an aarch64-darwin user to use the binaries produced by default. I tried anyway and got the predictable path /nix/.../glib does not exist error.

My first thought was "binary size doesn’t matter so much, I’ll use nix bundle" but that’s not supported on aarch64-darwin.

My next thought was the obvious "I know… I can use pkgsCross.aarch64-multiplatform-musl.pkgsStatic.haskell.packages.ghc92".

The only problem is that I got some assembler error on aarch64, and even on x86_64-linux I got errors with:

$ nix build nixpkgs#pkgsCross.aarch64-multiplatform-musl.pkgsStatic.haskell.compiler.ghc96 
       … while evaluating a branch condition

         at /nix/store/haqac3xk5vi8fn9gx156gjbm170351m7-source/lib/customisation.nix:92:7:

           91|     in
           92|       if builtins.isAttrs result then
             |       ^
           93|         result // {

       … while calling the 'isAttrs' builtin

         at /nix/store/haqac3xk5vi8fn9gx156gjbm170351m7-source/lib/customisation.nix:92:10:

           91|     in
           92|       if builtins.isAttrs result then
             |          ^
           93|         result // {

       error: assertion '((! (targetPlatform).isGhcjs) -> (targetCC == (pkgsHostTarget)' failed

       at /nix/store/haqac3xk5vi8fn9gx156gjbm170351m7-source/pkgs/development/compilers/ghc/common-hadrian.nix:253:1:

          252| # currently only able to build GHC if hostPlatform == buildPlatform.
          253| assert !targetPlatform.isGhcjs -> targetCC ==;
             | ^
          254| assert buildTargetLlvmPackages.llvm == llvmPackages.llvm;

Process /run/current-system/sw/bin/nix exited abnormally with code 1

Maybe one of the other cross architectures can work for my use case of “someone using aarch6-darwin that doesn’t have nix installed”?

Maybe just pkgsStatic is needed?

Of course I get the same error even for nix build nixpkgs#pkgsStatic.haskell.compiler.ghc96.

Any help or guidances is appreciated.


I talked to the folks in and at their advice created an issue in nixpkgs: