Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Package ghc-8.10.4 not supported on aarch64-darwin #336

Closed
Anton-4 opened this issue Nov 1, 2021 · 10 comments
Closed

Package ghc-8.10.4 not supported on aarch64-darwin #336

Anton-4 opened this issue Nov 1, 2021 · 10 comments

Comments

@Anton-4
Copy link

Anton-4 commented Nov 1, 2021

Trying to install master with:

nix-env -iA niv -f https://github.com/nmattia/niv/tarball/master \
    --substituters https://niv.cachix.org \
    --trusted-public-keys niv.cachix.org-1:X32PCg2e/zAm3/uD1ScqW2z/K0LtDyNV7RdaxIuLgQM=

Results in:

unpacking 'https://github.com/nmattia/niv/tarball/master'...
installing 'niv-0.2.19'
error: Package ‘ghc-8.10.4’ in /nix/store/4kf9qcy2g5zyzd9yxp7g1qpvn5i47kfb-nixpkgs-src/pkgs/development/compilers/ghc/8.10.4.nix:254 is not supported on ‘aarch64-darwin’, refusing to evaluate.

Updating to at least ghc-8.10.6 should fix this issue.
I did not see a ghc version defined in the code anywhere, so I was unable to fix the issue myself.

@Anton-4
Copy link
Author

Anton-4 commented Nov 1, 2021

After further investigation, it looks like this would require unstable nix packages.

@nmattia
Copy link
Owner

nmattia commented Nov 2, 2021

See also the discussion here, looks like there are some issues still: #332

@Anton-4
Copy link
Author

Anton-4 commented Nov 2, 2021

My colleague @BrianHicks found the following workaround:

diff --git a/shell.nix b/shell.nix
--- a/shell.nix
+++ b/shell.nix
 
 let
   sources = import nix/sources.nix { };
-  pkgs = import sources.nixpkgs { };
+  pkgs = import sources.nixpkgs {
+    system = if builtins.currentSystem == "aarch64-darwin" then
+      "x86_64-darwin"
+    else
+      builtins.currentSystem;
+  };
 

  inputs = with pkgs; [
     # meta-tools
-    (import sources.niv { }).niv
+    (pkgs.callPackage sources.niv { }).niv
  ];

This is not an airtight solution and may introduce some other problems, but I'm posting it here in case it can help anyone.

@nmattia
Copy link
Owner

nmattia commented Nov 2, 2021

Ah, looks like you're piggy backing on rosetta then? Arguably the shell.nix isn't great; you shouldn't have to tweak it to specify the system. It would be great to have system as an argument of default.nix and shell.nix. PR welcome!

@Anton-4
Copy link
Author

Anton-4 commented Nov 2, 2021

I'd like to, but I am both a nix beginner and short on spare time.

@Anton-4
Copy link
Author

Anton-4 commented Nov 2, 2021

Regarding potential problems using the workaround, this fixed it for me:

  • add extra-platforms = x86_64-darwin to /etc/nix/nix.conf (create the file if it does not exist)
  • install Rosetta 2: softwareupdate --install-rosetta
  • reboot

@Anton-4
Copy link
Author

Anton-4 commented Nov 5, 2021

For any future readers; I ran into more problems with this approach down the road, so instead I forked niv to make it use unstable packages, which fixed my issues.

@nmattia
Copy link
Owner

nmattia commented Nov 8, 2021

Thanks! I've created a PR to bump nixpkgs to the latest master. Would you mind giving it a try?

@nmattia
Copy link
Owner

nmattia commented Nov 8, 2021

Fixed in #339

@nmattia nmattia closed this as completed Nov 8, 2021
@Anton-4
Copy link
Author

Anton-4 commented Nov 8, 2021

Thanks @nmattia ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants