Distributed build on a different architecture failed


My localhost is a aarch64-darwin, and I’m trying to build a docker image for aarch64-linux on a aarch64-linux host.
It seems like that I can’t get nix to try to build with the remote host, it would fail with a “hostPlatform mismatch” error, and not an “unable to connect to …” one.

PS: SSH works on a port different from 22 for this remote host. I have not found a way to specify this. Maybe this is related ?

Expected output

My flake outputs runner, which is a derivation that produces a docker image.

Actual output

When I try to build it. I get the following error message:

       error: Package ‘shadow-4.14.2’ in /nix/store/h947mznq84fnw1igj3jgyisswqfma0hi-source/pkgs/os-specific/linux/shadow/default.nix:92 is not available on the requested hostPlatform:
         hostPlatform.config = "aarch64-apple-darwin"
         package.meta.platforms = [
... elided

However, I do have a remote builder set up.

I have tried…

  • nix build -j0 .#runner -vvvvvvvvv 2>&1 | grep 'decline', but no word ‘decline’ has been found. Note that I used the -j0 option to disable local build, but it still fails with the “hostPlatform mismatch” error.
  • nix store ping 'ssh://ubuntu@oracle' works for both my user and root on my local machine (aarch64-darwin).

My configuration

I have used this guide to set up my environment. The configuration is generated by the nix-darwin configuration here.

Here’s are some relevant configuration files:

ssh://leana@carbon x86_64-linux /Users/leana/.ssh/id_ed25519 1 1 nixos-test,benchmark,big-parallel,kvm - -
ssh://ubuntu@oracle aarch64-linux /Users/leana/.ssh/id_ed25519 1 4 nixos-test,benchmark,big-parallel,kvm - -


# WARNING: this file is generated from the nix.* options in
# your nix-darwin configuration. Do not edit it!
allowed-users = *
auto-optimise-store = false
build-users-group = nixbld
cores = 0
extra-sandbox-paths =
max-jobs = auto
require-sigs = true
sandbox = false
sandbox-fallback = false
substituters = https://leana8959.cachix.org https://nix-community.cachix.org https://llama-cpp.cachix.org https://cache.nixos.org/
trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= leana8959.cachix.org-1:CxQSAp8lcgMv8Me459of0jdXRW2tcyeYRKTiiUq8z0M= nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs= llama-cpp.cachix.org-1:H75X+w83wUKTIPSO1KWy9ADUrzThyGs8P5tmAbkWhQc=
trusted-substituters = https://leana8959.cachix.org https://nix-community.cachix.org https://llama-cpp.cachix.org
trusted-users = leana
experimental-features = nix-command flakes
allow-import-from-derivation = true
sandbox = true

Thank you for your precious time !

I figured out why !

It’s because I didn’t specify which arch I’m building for.
I should do nix build -j0 .#packages.aarch64-linux.runner instead of nix build -j0 .#runner, as the latter would fall back to packages.aarch64-darwin.runner.