Remote builds

NixOS rebuild can be run to build locally and push to a target (docs):

nixos-rebuild --target-host tomaskrupka.cz --use-remote-sudo switch -I nixos-config=configuration.nix

Or to build remotely and deploy locally with --build-host.

This works across architectures.

Distributed builds

We can setup the nix.buildMachines option wit ha list of remote builders, e.g.:

{
  nix.buildMachines = [ {
      hostName = "builder";
      system = "x86_64-linux";
      maxJobs = 12;
      speedFactor = 2;
      supportedFeatures = [ "nixos-test" "benchmark" "big-parallel" "kvm" ];
    }
  ...
  ] ;
}

The rebuild process then transparently chooses the best target to build on based on architecture / priority.