diff options
author | Maximilian Bosch <maximilian@mbosch.me> | 2022-01-31 18:03:24 +0100 |
---|---|---|
committer | Maximilian Bosch <maximilian@mbosch.me> | 2022-05-31 22:20:11 +0200 |
commit | 159b5815b527f466578a2d28fbf832617cc45b88 (patch) | |
tree | 40cc1d7317b4d85878b682b4b61b985ce1c4b28e /tests | |
parent | 078c80f7500edd3adc3be5f7fb2801ba346c1d81 (diff) |
repl: `--option pure-eval true` actually enables pure eval mode
To quote Eelco in #5867:
> Unfortunately we can't do
>
> evalSettings.pureEval.setDefault(false);
>
> because then we have to do the same in main.cc (where
> pureEval is set to true), and that would allow pure-eval
> to be disabled globally from nix.conf.
Instead, a command should specify that it should be impure by
default. Then, `evalSettings.pureEval` will be set to `false;` unless
it's overridden by e.g. a CLI flag.
In that case it's IMHO OK to be (theoretically) able to override
`pure-eval` via `nix.conf` because it doesn't have an effect on commands
where `forceImpureByDefault` returns `false` (i.e. everything where pure
eval actually matters).
Closes #5867
Diffstat (limited to 'tests')
-rw-r--r-- | tests/repl.sh | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/repl.sh b/tests/repl.sh index b6937b9e9..9e6a59f18 100644 --- a/tests/repl.sh +++ b/tests/repl.sh @@ -42,6 +42,11 @@ testRepl () { echo "$replOutput" echo "$replOutput" | grep -qs "while evaluating the file" \ || fail "nix repl --show-trace doesn't show the trace" + + nix repl "${nixArgs[@]}" --option pure-eval true 2>&1 <<< "builtins.currentSystem" \ + | grep "attribute 'currentSystem' missing" + nix repl "${nixArgs[@]}" 2>&1 <<< "builtins.currentSystem" \ + | grep "$(nix-instantiate --eval -E 'builtins.currentSystem')" } # Simple test, try building a drv |