Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

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

Typestring
Default"builder"

The user to use when connecting to remote build daemons.


server.distributedBuilds.builders

Typelist 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 using nix.buildMachines, and points outbound SSH authentication at core.openssh.hostPrivateKeyPath.
  • The builder user is automatically added to nix.settings.trusted-users on the build server.
  • The module uses self.nixosConfigurations to dynamically discover the system architecture of the build machines.

Operational Notes / Assumptions

  • A host declares the build server via server.distributedBuilder.builders in its host configuration.

References