aboutsummaryrefslogtreecommitdiff
path: root/src/libstore
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstore')
-rw-r--r--src/libstore/build.cc3
-rw-r--r--src/libstore/globals.hh3
-rw-r--r--src/libstore/machines.cc18
-rw-r--r--src/libstore/machines.hh2
4 files changed, 24 insertions, 2 deletions
diff --git a/src/libstore/build.cc b/src/libstore/build.cc
index e756d3377..8c2602a70 100644
--- a/src/libstore/build.cc
+++ b/src/libstore/build.cc
@@ -614,7 +614,8 @@ HookInstance::HookInstance()
settings.thisSystem,
std::to_string(settings.maxSilentTime),
std::to_string(settings.buildTimeout),
- std::to_string(verbosity)
+ std::to_string(verbosity),
+ settings.builders
};
execv(settings.buildHook.get().c_str(), stringsToCharPtrs(args).data());
diff --git a/src/libstore/globals.hh b/src/libstore/globals.hh
index 25cc3e068..d7a0b86a0 100644
--- a/src/libstore/globals.hh
+++ b/src/libstore/globals.hh
@@ -130,6 +130,9 @@ public:
PathSetting buildHook{this, true, nixLibexecDir + "/nix/build-remote", "build-hook",
"The path of the helper program that executes builds to remote machines."};
+ Setting<std::string> builders{this, "", "builders",
+ "A semicolon-separated list of build machines, in the format of nix.machines."};
+
Setting<off_t> reservedSize{this, 8 * 1024 * 1024, "gc-reserved-space",
"Amount of reserved disk space for the garbage collector."};
diff --git a/src/libstore/machines.cc b/src/libstore/machines.cc
index 471ce8efb..479ed1432 100644
--- a/src/libstore/machines.cc
+++ b/src/libstore/machines.cc
@@ -44,7 +44,7 @@ bool Machine::mandatoryMet(const std::set<string> & features) const {
void parseMachines(const std::string & s, Machines & machines)
{
- for (auto line : tokenizeString<std::vector<string>>(s, "\n")) {
+ for (auto line : tokenizeString<std::vector<string>>(s, "\n;")) {
chomp(line);
line.erase(std::find(line.begin(), line.end(), '#'), line.end());
if (line.empty()) continue;
@@ -62,4 +62,20 @@ void parseMachines(const std::string & s, Machines & machines)
}
}
+Machines getMachines()
+{
+ Machines machines;
+
+ try {
+ parseMachines(readFile(getEnv("NIX_REMOTE_SYSTEMS", settings.nixConfDir + "/machines")), machines);
+ } catch (const SysError & e) {
+ if (e.errNo != ENOENT)
+ throw;
+ }
+
+ parseMachines(settings.builders, machines);
+
+ return machines;
+}
+
}
diff --git a/src/libstore/machines.hh b/src/libstore/machines.hh
index 96c4bd81a..e04557428 100644
--- a/src/libstore/machines.hh
+++ b/src/libstore/machines.hh
@@ -32,4 +32,6 @@ typedef std::vector<Machine> Machines;
void parseMachines(const std::string & s, Machines & machines);
+Machines getMachines();
+
}