diff options
author | Cole Helbling <cole.e.helbling@outlook.com> | 2020-09-19 22:26:07 -0700 |
---|---|---|
committer | Cole Helbling <cole.e.helbling@outlook.com> | 2020-09-21 10:36:45 -0700 |
commit | ba37299a0364c4b58d59e20cf7821ed9fade6dd6 (patch) | |
tree | 3787dbb5c4598a493979869d907a9555c7088b4a /src/libstore/globals.cc | |
parent | 557d2427ee7c21b32e691e1c44f682b667673a70 (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.cc | 6 |
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; |