mirror of
https://github.com/NixOS/nix
synced 2025-06-26 20:01:15 +02:00
Add an option for specifying remote builders
This is useful for one-off situations where you want to specify a builder on the command line instead of having to mess with nix.machines. E.g. $ nix-build -A hello --argstr system x86_64-darwin \ --option builders 'root@macstadium1 x86_64-darwin' will perform the specified build on "macstadium1". It also removes the need for a separate nix.machines file since you can specify builders in nix.conf directly. (In fact nix.machines is yet another hack that predates the general nix.conf configuration file, IIRC.) Note: this option is supported by the daemon for trusted users. The fact that this allows trusted users to specify paths to SSH keys to which they don't normally have access is maybe a bit too much trust...
This commit is contained in:
parent
ebc9f36a81
commit
1a68710d4d
6 changed files with 27 additions and 12 deletions
|
@ -45,7 +45,7 @@ int main (int argc, char * * argv)
|
|||
unsetenv("DISPLAY");
|
||||
unsetenv("SSH_ASKPASS");
|
||||
|
||||
if (argc != 5)
|
||||
if (argc != 6)
|
||||
throw UsageError("called without required arguments");
|
||||
|
||||
auto store = openStore();
|
||||
|
@ -54,6 +54,7 @@ int main (int argc, char * * argv)
|
|||
settings.maxSilentTime = std::stoll(argv[2]);
|
||||
settings.buildTimeout = std::stoll(argv[3]);
|
||||
verbosity = (Verbosity) std::stoll(argv[4]);
|
||||
settings.builders = argv[5];
|
||||
|
||||
/* It would be more appropriate to use $XDG_RUNTIME_DIR, since
|
||||
that gets cleared on reboot, but it wouldn't work on OS X. */
|
||||
|
@ -62,13 +63,7 @@ int main (int argc, char * * argv)
|
|||
std::shared_ptr<Store> sshStore;
|
||||
AutoCloseFD bestSlotLock;
|
||||
|
||||
Machines machines;
|
||||
try {
|
||||
parseMachines(readFile(getEnv("NIX_REMOTE_SYSTEMS", SYSCONFDIR "/nix/machines")), machines);
|
||||
} catch (const SysError & e) {
|
||||
if (e.errNo != ENOENT)
|
||||
throw;
|
||||
}
|
||||
auto machines = getMachines();
|
||||
debug("got %d remote builders", machines.size());
|
||||
|
||||
if (machines.empty()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue