Skip to content

Instantly share code, notes, and snippets.

@fiksn
Created June 20, 2021 18:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fiksn/c7f1b3004fc962679ccb7132712c729e to your computer and use it in GitHub Desktop.
Save fiksn/c7f1b3004fc962679ccb7132712c729e to your computer and use it in GitHub Desktop.
Nix cross building
# Not NixOS has trouble (with non-interactive ssh)
export NIX_SSHOPTS="-q source ~/.profile 2>/dev/null;"
nix ping-store --store ssh://server && echo ok
# trusted-users in nix.conf
cat /etc/nix/nix.conf
sudo launchctl stop org.nixos.nix-daemon ; sudo launchctl start org.nixos.nix-daemon
bash $(nix-build '<nixpkgs>' -A gnu-config)/config.guess
# $ nix build '(with import <nixpkgs> { system = "x86_64-linux"; }; runCommand "foo" {} "uname > $out")'
# [25 copied (53.5 MiB), 11.9 MiB DL]
# error: a 'x86_64-linux' with features {} is required to build '/nix/store/izq6s2qrb2x3wbdqbm9ihrky7d88md0q-foo.drv', but I am a 'x86_64-darwin' with
# features {benchmark, big-parallel, nixos-test}
nix build '(with import <nixpkgs> { system = "x86_64-linux"; }; runCommand "foo" {} "uname > $out")' --builders 'ssh://server' -j0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment