diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2020-08-17 13:43:39 +0200 |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2020-08-17 13:43:39 +0200 |
commit | 7cdc739ece681128dd4153e53acb85867accdd1b (patch) | |
tree | c6c202a7f596f1077a3b6295344367b937963a5d /src/libstore/machines.cc | |
parent | bf290c2306d8554b82a9f1d30279b90bf8606fa6 (diff) | |
parent | e849b198720c60c186c8f9486c43c495ad436e1b (diff) |
Merge remote-tracking branch 'origin/master' into markdown
Diffstat (limited to 'src/libstore/machines.cc')
-rw-r--r-- | src/libstore/machines.cc | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/libstore/machines.cc b/src/libstore/machines.cc index f848582da..7db2556f4 100644 --- a/src/libstore/machines.cc +++ b/src/libstore/machines.cc @@ -1,6 +1,7 @@ #include "machines.hh" #include "util.hh" #include "globals.hh" +#include "store-api.hh" #include <algorithm> @@ -48,6 +49,29 @@ bool Machine::mandatoryMet(const std::set<string> & features) const { }); } +ref<Store> Machine::openStore() const { + Store::Params storeParams; + if (hasPrefix(storeUri, "ssh://")) { + storeParams["max-connections"] = "1"; + storeParams["log-fd"] = "4"; + if (sshKey != "") + storeParams["ssh-key"] = sshKey; + } + { + auto & fs = storeParams["system-features"]; + auto append = [&](auto feats) { + for (auto & f : feats) { + if (fs.size() > 0) fs += ' '; + fs += f; + } + }; + append(supportedFeatures); + append(mandatoryFeatures); + } + + return nix::openStore(storeUri, storeParams); +} + void parseMachines(const std::string & s, Machines & machines) { for (auto line : tokenizeString<std::vector<string>>(s, "\n;")) { |