From af241ae7d3d2a9975d43c9137806a6ffcb96e95b Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 24 Oct 2017 10:52:34 +0200 Subject: Remove the builder-files option You can now include files via the "builders" option, using the syntax "@". Having only one option makes it easier to override builders completely. For backward compatibility, the default is "@/etc/nix/machines", or "@" for each file name in NIX_REMOTE_SYSTEMS. --- src/libstore/machines.cc | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'src/libstore/machines.cc') 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 & features) const { void parseMachines(const std::string & s, Machines & machines) { for (auto line : tokenizeString>(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>(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; -- cgit 1.4.1