diff options
Diffstat (limited to 'src/nix')
-rw-r--r-- | src/nix/develop.cc | 9 | ||||
-rw-r--r-- | src/nix/flake.cc | 4 | ||||
-rw-r--r-- | src/nix/main.cc | 34 | ||||
-rw-r--r-- | src/nix/repl.cc | 2 | ||||
-rw-r--r-- | src/nix/upgrade-nix.cc | 2 |
5 files changed, 25 insertions, 26 deletions
diff --git a/src/nix/develop.cc b/src/nix/develop.cc index d1615ecdc..81bc73e12 100644 --- a/src/nix/develop.cc +++ b/src/nix/develop.cc @@ -19,13 +19,16 @@ using namespace nix; struct DevelopSettings : Config { Setting<std::string> bashPrompt{this, "", "bash-prompt", - "The bash prompt (`PS1`) in `nix develop` shells."}; + "The bash prompt (`PS1`) in `nix develop` shells.", + {}, true, Xp::NixCommand}; Setting<std::string> bashPromptPrefix{this, "", "bash-prompt-prefix", - "Prefix prepended to the `PS1` environment variable in `nix develop` shells."}; + "Prefix prepended to the `PS1` environment variable in `nix develop` shells.", + {}, true, Xp::NixCommand}; Setting<std::string> bashPromptSuffix{this, "", "bash-prompt-suffix", - "Suffix appended to the `PS1` environment variable in `nix develop` shells."}; + "Suffix appended to the `PS1` environment variable in `nix develop` shells.", + {}, true, Xp::NixCommand}; }; static DevelopSettings developSettings; diff --git a/src/nix/flake.cc b/src/nix/flake.cc index 0c704a995..1dc13fb3f 100644 --- a/src/nix/flake.cc +++ b/src/nix/flake.cc @@ -116,7 +116,7 @@ public: void run(nix::ref<nix::Store> store) override { - settings.tarballTtl = 0; + settings.tarballTtl.override(0); auto updateAll = lockFlags.inputUpdates.empty(); lockFlags.recreateLockFile = updateAll; @@ -158,7 +158,7 @@ struct CmdFlakeLock : FlakeCommand void run(nix::ref<nix::Store> store) override { - settings.tarballTtl = 0; + settings.tarballTtl.override(0); lockFlags.writeLockFile = true; lockFlags.applyNixConfig = true; diff --git a/src/nix/main.cc b/src/nix/main.cc index fdd3ac2ae..cf1f876dd 100644 --- a/src/nix/main.cc +++ b/src/nix/main.cc @@ -247,8 +247,8 @@ static void showHelp(std::vector<std::string> subcommand, NixArgs & toplevel) { auto mdName = subcommand.empty() ? "nix" : fmt("nix3-%s", concatStringsSep("-", subcommand)); - evalSettings.restrictEval = false; - evalSettings.pureEval = false; + evalSettings.restrictEval.override(false); + evalSettings.pureEval.override(false); EvalState state({}, openStore("dummy://")); auto vGenerateManpage = state.allocValue(); @@ -389,7 +389,7 @@ void mainWrapped(int argc, char * * argv) if (legacy) return legacy(argc, argv); } - evalSettings.pureEval = true; + evalSettings.pureEval.setDefault(true); setLogFormat(LogFormat::bar); settings.verboseBuild = false; @@ -408,11 +408,11 @@ void mainWrapped(int argc, char * * argv) } if (argc == 2 && std::string(argv[1]) == "__dump-language") { - experimentalFeatureSettings.experimentalFeatures = ExperimentalFeatures{} + experimentalFeatureSettings.experimentalFeatures.override(ExperimentalFeatures{} | Xp::Flakes | Xp::FetchClosure - | Xp::DynamicDerivations; - evalSettings.pureEval = false; + | Xp::DynamicDerivations); + evalSettings.pureEval.override(false); EvalState state({}, openStore("dummy://")); auto res = nlohmann::json::object(); res["builtins"] = ({ @@ -513,24 +513,20 @@ void mainWrapped(int argc, char * * argv) if (!args.useNet) { // FIXME: should check for command line overrides only. - if (!settings.useSubstitutes.overridden) - settings.useSubstitutes = false; - if (!settings.tarballTtl.overridden) - settings.tarballTtl = std::numeric_limits<unsigned int>::max(); - if (!fileTransferSettings.tries.overridden) - fileTransferSettings.tries = 0; - if (!fileTransferSettings.connectTimeout.overridden) - fileTransferSettings.connectTimeout = 1; + settings.useSubstitutes.setDefault(false); + settings.tarballTtl.setDefault(std::numeric_limits<unsigned int>::max()); + fileTransferSettings.tries.setDefault(0); + fileTransferSettings.connectTimeout.setDefault(1); } if (args.refresh) { - settings.tarballTtl = 0; - settings.ttlNegativeNarInfoCache = 0; - settings.ttlPositiveNarInfoCache = 0; + settings.tarballTtl.override(0); + settings.ttlNegativeNarInfoCache.override(0); + settings.ttlPositiveNarInfoCache.override(0); } - if (args.command->second->forceImpureByDefault() && !evalSettings.pureEval.overridden) { - evalSettings.pureEval = false; + if (args.command->second->forceImpureByDefault()) { + evalSettings.pureEval.setDefault(false); } args.command->second->run(); } diff --git a/src/nix/repl.cc b/src/nix/repl.cc index 88aeed859..13186277e 100644 --- a/src/nix/repl.cc +++ b/src/nix/repl.cc @@ -10,7 +10,7 @@ namespace nix { struct CmdRepl : RawInstallablesCommand { CmdRepl() { - evalSettings.pureEval = false; + evalSettings.pureEval.override(false); } /** diff --git a/src/nix/upgrade-nix.cc b/src/nix/upgrade-nix.cc index 15c5960d4..19f598874 100644 --- a/src/nix/upgrade-nix.cc +++ b/src/nix/upgrade-nix.cc @@ -72,7 +72,7 @@ struct CmdUpgradeNix : MixDryRun, EvalCommand void run(ref<Store> store) override { - evalSettings.pureEval = true; + evalSettings.pureEval.override(true); if (profileDir == "") { profileDir = getProfileDir(store); |