Closed supermarin closed 1 year ago
I think you need to choose the aarch64-linux
output and have a aarch64-linux
remote builder (maybe running in a VM). I don't think you can build nixos closures on macOS otherwise. You can use the nixosGenerate
function for that: https://github.com/Mic92/dotfiles/blob/master/nixos/images/default.nix#L40
@Mic92 thanks, I'm using nixosGenerate
but not sure how to pass in a remote builder option.
Is there a way to use a remote builder with nix build
CLI that I'm missing?
You need to pass the builder option to nix build
not nixosGenerate
:
This is an example for nix-ld
nix build --builders 'ssh-ng://nix@yasmin.dse.in.tum.de aarch64-linux /run/secrets/id_buildfarm 224 1 big-parallel,kvm,nixos-test - -' .#packages.aarch64-linux.nix-ld
/run/secrets/id_buildfarm
is my private ssh key and ssh-ng://nix@yasmin.dse.in.tum.de
my aarch64 builder.
Wasn't aware of the --builders
flag and have been looking for something like this! nix help build
man page doesn't list the option. Where is this documented?
These types of option are documented here: https://nixos.org/manual/nix/stable/command-ref/conf-file.html
@Mic92 that's ... the last place I'd be looking for it, and it's poorly documented at best.
Is there a reason this CLI flag is not referenced in man pages? I was initially looking in here but it's not clear to me how the man pages are generated/organized without spending significant amount of time.
Because it builder
actually a nix setting you would have in your configuration and not a command line flag, from nix.conf manpage:
You can override settings on the command line using the --option flag, e.g. --option keep-outputs false. Every configuration setting also has a corresponding command line flag, e.g. --max-jobs 16; for Boolean set‐ tings, there are two flags to enable or disable the setting (e.g. --keep-failed and --no-keep-failed).
I am closing this, because this is no longer in scope of nixos-generators.
For some reason I lived under impression that I was cross compiling a qcow aarch64-linux vm from a M1 mac. Turns out I was initially building the VM with a linux laptop and scp-ed ./result over to the mac. Taking a quick look into flake.nix I see that x86_64-darwin is supported but aarch64-darwin is not. I tried adding aarch64-darwin there but didn't make much progress. Am I missing something obvious, and would it be feasible to add this support in?