mirror of
https://github.com/NixOS/nix
synced 2025-06-27 16:51:15 +02:00
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.
This commit is contained in:
parent
557d2427ee
commit
ba37299a03
1 changed files with 6 additions and 0 deletions
|
@ -147,6 +147,12 @@ bool Settings::isWSL1()
|
||||||
|
|
||||||
const string nixVersion = PACKAGE_VERSION;
|
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)
|
template<> void BaseSetting<SandboxMode>::set(const std::string & str)
|
||||||
{
|
{
|
||||||
if (str == "true") value = smEnabled;
|
if (str == "true") value = smEnabled;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue