I have a nix workstation and a mac laptop. I’ve setup remote builds with the following /etc/nix/nix.conf
allowed-users = michael
trusted-users = michael
build-users-group = nixbld
builders-use-substitutes = true
builders = ssh://nix x86_64-darwin,x86_64-linux
For others looking to do a similar setup, the thing that was critical but unclear in the wiki was I needed to add the following /var/root/.ssh/config with a passwordless ssh key.
Host nix
HostName ***
User nix
IdentityFile /var/root/.ssh/id_rsa
IdentitiesOnly yes
StrictHostKeyChecking accept-new
ServerAliveInterval=15
ServerAliveCountMax=3000
Port 4920
However, when I attempt to build a package locally, I get the following error:
❯ nix-build '<nixpkgs>' --builders nix -j0 -A firefox
these derivations will be built:
/nix/store/jpraymhpsqh48gps6c78z64sf2a4iwds-libstartup-notification-0.12.drv
/nix/store/x4y2r22znsnrz885slg2b2c3bs3qdk66-firefox-unwrapped-72.0.2.drv
/nix/store/nyv8yb5dhpi1wrjzaf0wqra4dqkb8b80-Firefox-72.0.2.drv
building '/nix/store/jpraymhpsqh48gps6c78z64sf2a4iwds-libstartup-notification-0.12.drv' on 'ssh://nix'...
error: build of '/nix/store/jpraymhpsqh48gps6c78z64sf2a4iwds-libstartup-notification-0.12.drv' on 'ssh://nix' failed: a 'x86_64-darwin' with features {} is required to build '/nix/store/jpraymhpsqh48gps6c78z64sf2a4iwds-libstartup-notification-0.12.drv', but I am a 'x86_64-linux' with features {benchmark, big-parallel, kvm, nixos-test}
builder for '/nix/store/jpraymhpsqh48gps6c78z64sf2a4iwds-libstartup-notification-0.12.drv' failed with exit code 1
cannot build derivation '/nix/store/x4y2r22znsnrz885slg2b2c3bs3qdk66-firefox-unwrapped-72.0.2.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/nyv8yb5dhpi1wrjzaf0wqra4dqkb8b80-Firefox-72.0.2.drv': 1 dependencies couldn't be built
error: build of '/nix/store/nyv8yb5dhpi1wrjzaf0wqra4dqkb8b80-Firefox-72.0.2.drv' failed
I was under the impression cross-compilation for darwin worked automatically, given building a derivation for x86_64-darwin
on a Linux machine is explicitly mentioned in the nix manual. Is there a guide for enabling this?
This issue is partially relevant https://github.com/NixOS/nixpkgs/issues/60101