aboutsummaryrefslogtreecommitdiff
path: root/src/libstore
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2020-10-29 18:17:39 +0100
committerEelco Dolstra <edolstra@gmail.com>2020-10-29 18:17:39 +0100
commitff4dea63c9403880500f82ce273713ecf793d2d9 (patch)
treeaa565e5bd7bbaca2ab23b5e71cdac0c49e926937 /src/libstore
parentbb8e837e4ca95321141ad62fb3b2114310f2b24b (diff)
Generalize extra-* settings
This removes the extra-substituters and extra-sandbox-paths settings and instead makes every array setting extensible by setting "extra-<name> = <value>" in the configuration file or passing "--<name> <value>" on the command line.
Diffstat (limited to 'src/libstore')
-rw-r--r--src/libstore/build/derivation-goal.cc6
-rw-r--r--src/libstore/daemon.cc2
-rw-r--r--src/libstore/globals.cc9
-rw-r--r--src/libstore/globals.hh21
-rw-r--r--src/libstore/store-api.cc3
5 files changed, 9 insertions, 32 deletions
diff --git a/src/libstore/build/derivation-goal.cc b/src/libstore/build/derivation-goal.cc
index 7db83c8be..3dacb218c 100644
--- a/src/libstore/build/derivation-goal.cc
+++ b/src/libstore/build/derivation-goal.cc
@@ -1332,13 +1332,9 @@ void DerivationGoal::startBuilder()
/* Allow a user-configurable set of directories from the
host file system. */
- PathSet dirs = settings.sandboxPaths;
- PathSet dirs2 = settings.extraSandboxPaths;
- dirs.insert(dirs2.begin(), dirs2.end());
-
dirsInChroot.clear();
- for (auto i : dirs) {
+ for (auto i : settings.sandboxPaths.get()) {
if (i.empty()) continue;
bool optional = false;
if (i[i.size() - 1] == '?') {
diff --git a/src/libstore/daemon.cc b/src/libstore/daemon.cc
index 99d8add92..4dbc7ba38 100644
--- a/src/libstore/daemon.cc
+++ b/src/libstore/daemon.cc
@@ -231,8 +231,6 @@ struct ClientSettings
settings.set(name, value);
else if (setSubstituters(settings.substituters))
;
- else if (setSubstituters(settings.extraSubstituters))
- ;
else
debug("ignoring the client-specified setting '%s', because it is a restricted setting and you are not a trusted user", name);
} catch (UsageError & e) {
diff --git a/src/libstore/globals.cc b/src/libstore/globals.cc
index 4df68d0c9..f38601d6d 100644
--- a/src/libstore/globals.cc
+++ b/src/libstore/globals.cc
@@ -160,7 +160,7 @@ NLOHMANN_JSON_SERIALIZE_ENUM(SandboxMode, {
{SandboxMode::smDisabled, false},
});
-template<> void BaseSetting<SandboxMode>::set(const std::string & str)
+template<> void BaseSetting<SandboxMode>::set(const std::string & str, bool append)
{
if (str == "true") value = smEnabled;
else if (str == "relaxed") value = smRelaxed;
@@ -168,6 +168,11 @@ template<> void BaseSetting<SandboxMode>::set(const std::string & str)
else throw UsageError("option '%s' has invalid value '%s'", name, str);
}
+template<> bool BaseSetting<SandboxMode>::isAppendable()
+{
+ return false;
+}
+
template<> std::string BaseSetting<SandboxMode>::to_string() const
{
if (value == smEnabled) return "true";
@@ -198,7 +203,7 @@ template<> void BaseSetting<SandboxMode>::convertToArg(Args & args, const std::s
});
}
-void MaxBuildJobsSetting::set(const std::string & str)
+void MaxBuildJobsSetting::set(const std::string & str, bool append)
{
if (str == "auto") value = std::max(1U, std::thread::hardware_concurrency());
else if (!string2Int(str, value))
diff --git a/src/libstore/globals.hh b/src/libstore/globals.hh
index 8c63c5b34..eabd83e3f 100644
--- a/src/libstore/globals.hh
+++ b/src/libstore/globals.hh
@@ -25,7 +25,7 @@ struct MaxBuildJobsSetting : public BaseSetting<unsigned int>
options->addSetting(this);
}
- void set(const std::string & str) override;
+ void set(const std::string & str, bool append = false) override;
};
class Settings : public Config {
@@ -413,14 +413,6 @@ public:
Setting<bool> sandboxFallback{this, true, "sandbox-fallback",
"Whether to disable sandboxing when the kernel doesn't allow it."};
- Setting<PathSet> extraSandboxPaths{
- this, {}, "extra-sandbox-paths",
- R"(
- A list of additional paths appended to `sandbox-paths`. Useful if
- you want to extend its default value.
- )",
- {"build-extra-chroot-dirs", "build-extra-sandbox-paths"}};
-
Setting<size_t> buildRepeat{
this, 0, "repeat",
R"(
@@ -599,17 +591,6 @@ public:
)",
{"binary-caches"}};
- // FIXME: provide a way to add to option values.
- Setting<Strings> extraSubstituters{
- this, {}, "extra-substituters",
- R"(
- Additional binary caches appended to those specified in
- `substituters`. When used by unprivileged users, untrusted
- substituters (i.e. those not listed in `trusted-substituters`) are
- silently ignored.
- )",
- {"extra-binary-caches"}};
-
Setting<StringSet> trustedSubstituters{
this, {}, "trusted-substituters",
R"(
diff --git a/src/libstore/store-api.cc b/src/libstore/store-api.cc
index 9f21f0434..83d3a1fa1 100644
--- a/src/libstore/store-api.cc
+++ b/src/libstore/store-api.cc
@@ -1114,9 +1114,6 @@ std::list<ref<Store>> getDefaultSubstituters()
for (auto uri : settings.substituters.get())
addStore(uri);
- for (auto uri : settings.extraSubstituters.get())
- addStore(uri);
-
stores.sort([](ref<Store> & a, ref<Store> & b) {
return a->priority < b->priority;
});