mirror of
https://github.com/NixOS/nix
synced 2025-06-24 13:51:16 +02:00
Complain when using --pure-eval with --file
This never worked and cannot work because in pure eval mode, the evaluator doesn't have access to the file.
This commit is contained in:
parent
9099b7dd87
commit
d46f741cdf
2 changed files with 8 additions and 1 deletions
|
@ -491,7 +491,11 @@ Installables SourceExprCommand::parseInstallables(
|
|||
throw UsageError("'--file' and '--expr' are exclusive");
|
||||
|
||||
// FIXME: backward compatibility hack
|
||||
if (file) evalSettings.pureEval = false;
|
||||
if (file) {
|
||||
if (evalSettings.pureEval && evalSettings.pureEval.overridden)
|
||||
throw UsageError("'--file' is not compatible with '--pure-eval'");
|
||||
evalSettings.pureEval = false;
|
||||
}
|
||||
|
||||
auto state = getEvalState();
|
||||
auto vFile = state->allocValue();
|
||||
|
|
|
@ -39,6 +39,9 @@ nix-instantiate --eval -E 'assert 1 + 2 == 3; true'
|
|||
ln -sfn cycle.nix "$TEST_ROOT/cycle.nix"
|
||||
(! nix eval --file "$TEST_ROOT/cycle.nix")
|
||||
|
||||
# --file and --pure-eval don't mix.
|
||||
expectStderr 1 nix eval --pure-eval --file "$TEST_ROOT/cycle.nix" | grepQuiet "not compatible"
|
||||
|
||||
# Check that relative symlinks are resolved correctly.
|
||||
mkdir -p "$TEST_ROOT/xyzzy" "$TEST_ROOT/foo"
|
||||
ln -sfn ../xyzzy "$TEST_ROOT/foo/bar"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue