-
-
Notifications
You must be signed in to change notification settings - Fork 467
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
Using the new native M1 support #334
Comments
Thanks a lot for this tip. I've finally got the wheels running after mostly commenting out package overrides based on nixpkgs PR's. I went the other way around it. Instead of selecting the aarch64 packages, I overlay the x86_64's.
I use with to thoroughly set the stdenv. { ... }:
# just a tarball of the latest master
with import (fetchTarball /. + "file:///Users/hlolli/nixpkgs-fork.tar.gz") { localSystem = "aarch64-darwin"; };
{
imports = [
/Users/hlolli/nixos-configuration
];
}
I have the two versions { stdenv, config, pkgs, ... }:
let pkgsX86 = import <nixpkgs> { localSystem = "x86_64-darwin"; };
... and overlay the unsupported packages ...
nixpkgs.overlays = [
(
self: super: {
inherit (pkgsX86) haskell haskellPackages openssl openssl_1_1;
}
)];
... long rebuild ahead rn, praying for luck 🙏 |
I don't think that overlay will do what you want as it mixes x86 and arm libraries. To build a mixed system you most likely want to use the same overlays for both package sets and between the architecture at binary level. { config, lib, pkgs, ... }:
let pkgsX86 = import <nixpkgs> { localSystem = "x86_64-darwin"; overlays = config.nixpkgs.overlays; };
{
environment.systemPackages =
[ pkgs.curl
pkgsX86.haskell
];
} |
Yes indeed, I should have known, but the rosetta2 magic has spelled my senses here.
Besides the fact that openssl compiles fine on aarch (so far so good after I removed it from the overlay), then I hope this adverts pitfalls for others. |
Maybe not the right place for it, but I have a PR for emacs fix for aarch64, if someone wants to review and test the fix NixOS/nixpkgs#124888 |
I've gotten a flake.nix-based configuration working working, where I install the rosetta x86-64 packages by default and opt into arm64 packages on a case-by-case basis. Here's the relevant flake.nix bits: {
outputs = {self, nixpkgs, darwin, ...}: {
darwinConfigs."my-machine" = darwin.lib.darwinSystem {
modules = [
{ nix.extraOptions = ''extra-platforms = x86_64-darwin aarch64-darwin ''; }
./machine/my-machine.nix
];
specialArgs = {
m1Ize = (pkgs: config: import nixpkgs {
system = "aarch64-darwin";
overlays = config.nixpkgs.overlays;
});
};
};
};
} note the { pkgs, config, lib, m1Ize, ... }:
let
m1Pkgs = m1Ize pkgs config;
in
{
environment.systemPackages = with m1Pkgs; [
cmake
llvm
openssl
gnumake
postgresql_13
];
} You have to use that |
For those that stumble on this and, like me, use a pure nixpkgs install (i.e don't use nix-darwin, flakes, or whatever), I'm popping up a
Now I'm a complete beginner, so if only I knew how to pivot the nixpkgs install into arm64 😅 I'd rather be arm64 first and fill in the blanks with x86_64 on a case by case basis with an additional
|
@lloeki By default the nix client evaluates using the system it was built with. So upgrading you nix installation to the arm build will also change the default. |
Thanks @LnL7, I think I managed to do it:
From there I think I can remove |
Hi, I'm having an error with installing Please let me know if you need any other information that may help with solving the issue. Thank you for the amazing project and your time! Edit: Sorry for cluttering up the thread. The error in question was due to a package not cooperating with aarch64 (Neovim-nightly), nix-darwin itself was/is working fine. I apologize for my noob behavior. Thanks for the great project once again! |
I followed both of your above approach while being on macOS Big Sur. So far I was able to follow the steps, but activating "nix-shell" within the plutus project would give me the following:
I tried:
Each options of a - c, so far the same error reappears. I've also attempted your approach as clean installs. |
@purcell , Steve what is your current setup for getting things working on the M1 ? |
Note that ghc builds as of today on master. More package fixes are pending in haskell-updates (including cachix). |
Flake.nix needs to pass the correct system to Line 1 in a7492a8
|
Anyone have a sample |
In order to get this working I had to |
@shaunsingh Add this to your nix.extraOptions = ''
extra-platforms = aarch64-darwin x86_64-darwin
experimental-features = nix-command flakes
''; |
@domenkozar in your comment here you mention that:
Presumably this fix is for the "cannot coerce null to a string" bug. Would you happen to recall what PR/commit introduced this fix and what the problem was (I'm wondering if I can backport the fix to an older nixpkgs). Thanks in advance. |
This was related to signing and process getting killed, so your error message is something different/new. |
Is there still an issue with native M1 support? I installed nix-darwin recently on an M1 and I seem to get everything on aarch64-darwin without having done anything special. |
Agree, I'll go ahead and close this: I opened it mainly to share info, and there's indeed no current issue on these machines. |
Apple M1 (
aarch64-darwin
) support just landed in Nixpkgsmaster
, so I thought I'd open an issue here to describe/discuss how best to migrate to anix-darwin
setup which uses that system type by default.I've had some luck with this, so I'll recount what I've done. Starting with a regular
x86_64-darwin
installation, on thenixpkgs-unstable
channel, I addedto
nix.extraOptions
and defined a package set likeAt this point, it's possible to set
nix.pkg = pkgsM1.nix
, and then afterdarwin-rebuild switch
, the nix tools and overall system are switched to aarch64, andpkgs
will yieldaarch64
packages.However, of course many packages in a user's configuration won't build on
aarch64
, so to get to this stage, you have to comment out those packages. After switching the nix installation toaarch64
, the packages can be added back in, with a similarpkgs_x86
.Notable packages (for me) which don't yet build on
aarch64
arenix-direnv
and anything written in Haskell, likeshellcheck
,niv
.It's also possible to skip switching
nix.pkg
, and keep the overall system asx86_64
for now: then, packages can be included frompkgsM1
for installation as desired. This might be the best choice for most users until some of the rough edges are smoothed off.Hope this helps some people. I'd be keen to hear tips and tricks from others.
The text was updated successfully, but these errors were encountered: