provision buildMachines from data file
1 file changed, 51 insertions(+), 0 deletions(-)
changed files
A system/roles/nix-build-client.nix
@@ -0,0 +1,51 @@ +{ + lib, + ... +}: +let + inherit (import ../../data) machines; + + mkKnownHost = + name: + { publicKey, domains, ... }: + { + inherit publicKey; + extraHostNames = map (domain: "${name}.${domain}") domains; + }; + + mkBuilder = + { + system, + systems ? [ system ], + sshUser ? "nixremote", + protocol ? "ssh-ng", + ... + }@builder: + builder + // { + inherit + sshUser + systems + protocol + ; + }; + + mkBuildMachine = + hostName: machine: + (mkBuilder machine.builder) + // { + inherit hostName; + }; +in +{ + programs.ssh.knownHosts = lib.mapAttrs mkKnownHost machines; + nix = { + distributedBuilds = true; + + buildMachines = lib.mapAttrsToList mkBuildMachine (lib.filterAttrs (n: v: v ? builder) machines); + + settings = { + connect-timeout = 1; + }; + }; +}