aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/globals.cc
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2017-06-07 16:17:17 +0200
committerEelco Dolstra <edolstra@gmail.com>2017-06-07 16:17:17 +0200
commitb8283773bd64d7da6859ed520ee19867742a03ba (patch)
tree040443ef177a1a5ec1795fe9bd52d2b050d2fee8 /src/libstore/globals.cc
parentc8cc50d46e78de7ae02c2cb7a5159e995c993f61 (diff)
nix: Make all options available as flags
Thus, instead of ‘--option <name> <value>’, you can write ‘--<name> <value>’. So --option http-connections 100 becomes --http-connections 100 Apart from brevity, the difference is that it's not an error to set a non-existent option via --option, but unrecognized arguments are fatal. Boolean options have special treatment: they're mapped to the argument-less flags ‘--<name>’ and ‘--no-<name>’. E.g. --option auto-optimise-store false becomes --no-auto-optimise-store
Diffstat (limited to 'src/libstore/globals.cc')
-rw-r--r--src/libstore/globals.cc7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/libstore/globals.cc b/src/libstore/globals.cc
index 3dd2508a2..3f2bea8e7 100644
--- a/src/libstore/globals.cc
+++ b/src/libstore/globals.cc
@@ -98,6 +98,13 @@ template<> void BaseSetting<SandboxMode>::toJSON(JSONPlaceholder & out)
AbstractSetting::toJSON(out);
}
+template<> void BaseSetting<SandboxMode>::convertToArg(Args & args)
+{
+ args.mkFlag(0, name, {}, "Enable sandboxing.", 0, [=](Strings ss) { value = smEnabled; });
+ args.mkFlag(0, "no-" + name, {}, "Disable sandboxing.", 0, [=](Strings ss) { value = smDisabled; });
+ args.mkFlag(0, "relaxed-" + name, {}, "Enable sandboxing, but allow builds to disable it.", 0, [=](Strings ss) { value = smRelaxed; });
+}
+
void MaxBuildJobsSetting::set(const std::string & str)
{
if (str == "auto") value = std::max(1U, std::thread::hardware_concurrency());