Server Distributed Builds — Remote Nix Build Distribution
Purpose
The distributed builds module allows for distributed building of Nix derivations using remote build machines, providing a coordinator host and several build machines to distribute the build load across the server cluster.
Entry Point
- Main file:
modules/nixos/server/distributed-builds.nix
Options
server.distributedBuilds.builderUser
| Type | string |
| Default | "builder" |
The user to use when connecting to remote build daemons.
server.distributedBuilds.builders
| Type | list of string |
| Default | [ ] |
A list of hostnames of remote build daemons to connect to for distributed builds.
Architecture / Services / Scope
- This module coordinates the creation of a system user (
builder) on the build server and adds the necessary SSH keys to allow other hosts to connect. - On the hosts using the build server, the module automatically configures
nix.distributedBuilds, sets up the build machines usingnix.buildMachines, and points outbound SSH authentication atcore.openssh.hostPrivateKeyPath. - The
builderuser is automatically added tonix.settings.trusted-userson the build server. - The module uses
self.nixosConfigurationsto dynamically discover the system architecture of the build machines.
Operational Notes / Assumptions
- A host declares the build server via
server.distributedBuilder.buildersin its host configuration.