1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-12-03 23:51:00 +01:00

nix-cli: use pure/restricted eval for help pages

This avoids any complications that can arise from the environment
affecting evaluation of the help pages (which don't need to be calling
out to anything external anyways)

A recent example of one of these problems is
https://github.com/NixOS/nix/issues/14085, which would break help pages
by causing them to make invalid calls to the dummy store they're
evaluated with

Fixes: https://github.com/NixOS/nix/issues/14062
Co-authored-by: Sergei Zimmerman <sergei@zimmerman.foo>
This commit is contained in:
Seth Flynn 2025-09-26 02:03:50 -04:00
parent 89141f1d67
commit ff82de86da
No known key found for this signature in database
GPG key ID: D31BD0D494BBEE86

View file

@ -226,8 +226,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 = true;
evalSettings.pureEval = true;
EvalState state({}, openStore("dummy://"), fetchSettings, evalSettings);
auto vGenerateManpage = state.allocValue();