nix-darwin
nix-darwin copied to clipboard
linux-builder fails with generic/unhelpful error when nix.linux-builder.package uses nixpkgs unstable
In my flake, I have nixpkgs.url
set to unstable. When I set nix.linux-builder.enable = true;
, my Nix-Darwin build fails with the following error:
error: a 'aarch64-linux' with features {} is required to build '/nix/store/702shz6g4mydpmbdfwwj19lxdi3n1p69-boot.json.drv', but I am a 'aarch64-darwin' with features {benchmark, big-parallel, nixos-test}
When I reached out for help in Matrix, I was made aware that linux-builder may not have caches set up for unstable. I was able to resolve my issue by setting nix.linux-builder.package
to nixpkgs-stable.legacyPackages.${system}.darwin.linux-builder
-- in my case, nixpkgs-stable
is an input pointing to nixpkgs
23.11 release.
It would be helpful if a more useful error message appeared, or a disclaimer in the documentation that nixpkgs unstable may not work with linux-builder
out of the box and to maybe set nix.linux-builder.package
to the latest stable release of nixpkgs.
But mostly, I wanted to share this in case others encountered the same error as myself.
(Thank you thank you thank you for this great MacOS+Nix feature, btw!)
Were you using nixos-unstable
or nixpkgs-unstable
?
darwin.linux-builder
should always be cached on nixpkgs-unstable
as per this file:
https://github.com/NixOS/nixpkgs/blob/master/pkgs/top-level/release.nix#L208
Aha! I was using nixos-unstable. Thank you for the clarification.
I seem to be hitting this with nixpkgs-unstable - any ideas?
I seem to be hitting this with nixpkgs-unstable - any ideas?
Previously,nixpkgs-unstable
worked for me. But then it doesn't work anymore. So replacing it with nixpkgs-23.11-darwin
worked