about summary refs log tree commit diff
path: root/src/libstore/machines.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstore/machines.cc')
-rw-r--r--src/libstore/machines.cc18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/libstore/machines.cc b/src/libstore/machines.cc
index 471ce8efb9a2..479ed1432fb5 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;
+}
+
 }