aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/globals.cc
diff options
context:
space:
mode:
authorCole Helbling <cole.e.helbling@outlook.com>2020-09-19 22:26:07 -0700
committerCole Helbling <cole.e.helbling@outlook.com>2020-09-21 10:36:45 -0700
commitba37299a0364c4b58d59e20cf7821ed9fade6dd6 (patch)
tree3787dbb5c4598a493979869d907a9555c7088b4a /src/libstore/globals.cc
parent557d2427ee7c21b32e691e1c44f682b667673a70 (diff)
Serialize SandboxMode enum to string for JSON
Rather than showing an integer as the default, instead show the boolean referenced in the description. The nix.conf.5 manpage used to show "default: 0", which is unnecessarily opaque and confusing (doesn't 0 mean false, even though the default is true?); now it properly shows that the default is true.
Diffstat (limited to 'src/libstore/globals.cc')
-rw-r--r--src/libstore/globals.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/libstore/globals.cc b/src/libstore/globals.cc
index 0beb9b2b7..f94d97cc8 100644
--- a/src/libstore/globals.cc
+++ b/src/libstore/globals.cc
@@ -147,6 +147,12 @@ bool Settings::isWSL1()
const string nixVersion = PACKAGE_VERSION;
+NLOHMANN_JSON_SERIALIZE_ENUM(SandboxMode, {
+ {SandboxMode::smEnabled, true},
+ {SandboxMode::smRelaxed, "relaxed"},
+ {SandboxMode::smDisabled, false},
+});
+
template<> void BaseSetting<SandboxMode>::set(const std::string & str)
{
if (str == "true") value = smEnabled;