Support Nix's mandatoryFeatures

Extend the buildMachines option to support specification of
supportedFeatures and mandatoryFeatures in order to support all
configuration options of the nix.machines file.
This commit is contained in:
Martin Bravenboer 2013-07-25 20:39:44 -07:00 committed by Eelco Dolstra
parent 24a44c98d2
commit 7bd50185ff

View File

@ -155,26 +155,32 @@ in
sshKey = "/root/.ssh/id_buildfarm"; sshKey = "/root/.ssh/id_buildfarm";
system = "x86_64-linux"; system = "x86_64-linux";
maxJobs = 2; maxJobs = 2;
supportedFeatures = "kvm";
mandatoryFeatures = "perf";
} }
]; ];
description = " description = "
This option lists the machines to be used if distributed This option lists the machines to be used if distributed
builds are enabled (see builds are enabled (see
<option>nix.distributedBuilds</option>). Nix will perform <option>nix.distributedBuilds</option>). Nix will perform
derivations on those machines via SSh by copying the inputs to derivations on those machines via SSh by copying the inputs
the Nix store on the remote machine, starting the build, then to the Nix store on the remote machine, starting the build,
copying the output back to the local Nix store. Each element then copying the output back to the local Nix store. Each
of the list should be an attribute set containing the element of the list should be an attribute set containing
machine's host name (<varname>hostname</varname>), the user the machine's host name (<varname>hostname</varname>), the
name to be used for the SSH connection user name to be used for the SSH connection
(<varname>sshUser</varname>), the Nix system type (<varname>sshUser</varname>), the Nix system type
(<varname>system</varname>, e.g., (<varname>system</varname>, e.g.,
<literal>\"i686-linux\"</literal>), the maximum number of jobs <literal>\"i686-linux\"</literal>), the maximum number of
to be run in parallel on that machine jobs to be run in parallel on that machine
(<varname>maxJobs</varname>), and the path to the SSH private (<varname>maxJobs</varname>), the path to the SSH private
key to be used to connect (<varname>sshKey</varname>). The key to be used to connect (<varname>sshKey</varname>), a
SSH private key should not have a passphrase, and the list of supported features of the machine
corresponding public key should be added to (<varname>supportedFeatures</varname>) and a list of
mandatory features of the machine
(<varname>mandatoryFeatures</varname>). The SSH private key
should not have a passphrase, and the corresponding public
key should be added to
<filename>~<replaceable>sshUser</replaceable>/authorized_keys</filename> <filename>~<replaceable>sshUser</replaceable>/authorized_keys</filename>
on the remote machine. on the remote machine.
"; ";
@ -263,6 +269,10 @@ in
+ (if machine ? system then machine.system else concatStringsSep "," machine.systems) + (if machine ? system then machine.system else concatStringsSep "," machine.systems)
+ " ${machine.sshKey} ${toString machine.maxJobs} " + " ${machine.sshKey} ${toString machine.maxJobs} "
+ (if machine ? speedFactor then toString machine.speedFactor else "1" ) + (if machine ? speedFactor then toString machine.speedFactor else "1" )
+ " "
+ (if machine ? supportedFeatures then concatStringsSep "," machine.supportedFeatures else "" )
+ " "
+ (if machine ? mandatoryFeatures then concatStringsSep "," machine.mandatoryFeatures else "" )
+ "\n" + "\n"
) cfg.buildMachines; ) cfg.buildMachines;
}; };