about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/libstore/globals.cc7
-rw-r--r--src/libstore/globals.hh6
-rw-r--r--src/libstore/machines.cc24
3 files changed, 21 insertions, 16 deletions
diff --git a/src/libstore/globals.cc b/src/libstore/globals.cc
index 7da4bce87753..bef2510d9492 100644
--- a/src/libstore/globals.cc
+++ b/src/libstore/globals.cc
@@ -53,7 +53,12 @@ Settings::Settings()
 
     /* Backwards compatibility. */
     auto s = getEnv("NIX_REMOTE_SYSTEMS");
-    if (s != "") builderFiles = tokenizeString<Strings>(s, ":");
+    if (s != "") {
+        Strings ss;
+        for (auto & p : tokenizeString<Strings>(s, ":"))
+            ss.push_back("@" + p);
+        builders = concatStringsSep(" ", ss);
+    }
 
 #if defined(__linux__) && defined(SANDBOX_SHELL)
     sandboxPaths = tokenizeString<StringSet>("/bin/sh=" SANDBOX_SHELL);
diff --git a/src/libstore/globals.hh b/src/libstore/globals.hh
index 12d57b3e7647..4980615dc3f5 100644
--- a/src/libstore/globals.hh
+++ b/src/libstore/globals.hh
@@ -138,13 +138,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",
+    Setting<std::string> builders{this, "@" + nixConfDir + "/machines", "builders",
         "A semicolon-separated list of build machines, in the format of nix.machines."};
 
-    Setting<Strings> builderFiles{this,
-        {nixConfDir + "/machines"}, "builder-files",
-        "A list of files specifying build 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 076c3cab3e90..d2faf45357e3 100644
--- a/src/libstore/machines.cc
+++ b/src/libstore/machines.cc
@@ -47,9 +47,22 @@ 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;")) {
-        chomp(line);
+        trim(line);
         line.erase(std::find(line.begin(), line.end(), '#'), line.end());
         if (line.empty()) continue;
+
+        if (line[0] == '@') {
+            auto file = trim(std::string(line, 1));
+            try {
+                parseMachines(readFile(file), machines);
+            } catch (const SysError & e) {
+                if (e.errNo != ENOENT)
+                    throw;
+                debug("cannot find machines file '%s'", file);
+            }
+            continue;
+        }
+
         auto tokens = tokenizeString<std::vector<string>>(line);
         auto sz = tokens.size();
         if (sz < 1)
@@ -74,15 +87,6 @@ Machines getMachines()
 {
     Machines machines;
 
-    for (auto & file : settings.builderFiles.get()) {
-        try {
-            parseMachines(readFile(file), machines);
-        } catch (const SysError & e) {
-            if (e.errNo != ENOENT)
-                throw;
-        }
-    }
-
     parseMachines(settings.builders, machines);
 
     return machines;