diff options
author | alois31 <alois1@gmx-topmail.de> | 2024-10-23 15:20:51 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@localhost> | 2024-10-23 15:20:51 +0000 |
commit | 2734a9cf94debc6baef4e7d4d9fa28cc28f5b31d (patch) | |
tree | ba6be97cc5ac268941b1c8ac10507786a720357c /src/nix/main.cc | |
parent | 5f1344dd8aec59ce654a0fac30b1842e2e68299c (diff) | |
parent | 689eb45630a183f0fbbd8864cb7a3c7cb1704451 (diff) |
* changes:
treewide: make more settings conditionally available
libstore/build: only send overridden settings to the build hook
treewide: consistently mark overridden settings as such
Diffstat (limited to 'src/nix/main.cc')
-rw-r--r-- | src/nix/main.cc | 34 |
1 files changed, 15 insertions, 19 deletions
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(); } |