Skip to content

Build Modes

Choose where the Nix closure is built: locally on the machine running Panix (default), or remotely on the installable’s first machine.

Builds run on the machine executing Panix:

Terminal window
nix build --no-link --print-out-paths --keep-going <flake-url>#<installable>

Panix also passes the experimental features flags and any configured nix command flags; the same applies to the remote command below. The closure is then transferred to each target machine via nix copy. Machines whose hostname matches local_machine_hostname skip the transfer entirely: they share the local store.

Builds run on the installable’s first machine via the Nix remote store protocol:

Terminal window
nix build --eval-store auto --store ssh-ng://<first-machine> --option builders "" --no-link --print-out-paths --keep-going <flake-url>#<installable>

Use remote mode when:

  • The target machine has more resources (CPU/RAM) than the machine running Panix
  • The machine running Panix and the targets are not the same architecture
fleet:
flakes:
my-flake:
url: <url>
installables:
nixosConfigurations:
my-server:
nix:
build_mode: remote
machines:
builder-and-target: # first machine: remote builder and target
ssh:
hostname: 192.168.1.100
target-2: # closure copied from builder-and-target
ssh:
hostname: 192.168.1.101

build_mode can be set at fleet, flake, or installable level, inherited like other nix options. It cannot be set at machine level, since build is a per-installable phase shared by the installable’s machines.

For advanced distributed builds: