nix-darwin icon indicating copy to clipboard operation
nix-darwin copied to clipboard

linux-builder fails with generic/unhelpful error when nix.linux-builder.package uses nixpkgs unstable

Open heywoodlh opened this issue 7 months ago • 4 comments

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!)

heywoodlh avatar Jan 16 '24 18:01 heywoodlh

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

Enzime avatar Jan 17 '24 00:01 Enzime

Aha! I was using nixos-unstable. Thank you for the clarification.

heywoodlh avatar Jan 17 '24 01:01 heywoodlh

I seem to be hitting this with nixpkgs-unstable - any ideas?

georgealexanderday avatar May 01 '24 20:05 georgealexanderday

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

Fallenbagel avatar May 05 '24 23:05 Fallenbagel