diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2020-01-29 21:01:34 +0100 |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2020-01-29 21:04:28 +0100 |
commit | 26f895a26d37ec6049628fa835e20dfae5eb94dd (patch) | |
tree | 346863a05459c74bafcea95e0446c45c17bf581b /tests | |
parent | f68bed7f67d9acc13ebe38e6f5aa8a641f6e557d (diff) |
Clean up the lock file handling flags
Added a flag --no-update-lock-file to barf if the lock file needs any
changes. This is useful for CI systems if you're building a
checkout. Fixes #2947.
Renamed --no-save-lock-file to --no-write-lock-file. It is now a fatal
error if the lock file needs changes but --no-write-lock-file is not
given.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/flakes.sh | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/tests/flakes.sh b/tests/flakes.sh index 1b1912129..3eae73cdf 100644 --- a/tests/flakes.sh +++ b/tests/flakes.sh @@ -156,9 +156,15 @@ nix path-info $flake1Dir/result (! nix eval --expr "builtins.getFlake \"$flake2Dir\"") # But should succeed in impure mode. -nix build -o $TEST_ROOT/result flake2#bar --impure +(! nix build -o $TEST_ROOT/result flake2#bar --impure) +nix build -o $TEST_ROOT/result flake2#bar --impure --no-write-lock-file -# Test automatic lock file generation. +# Building a local flake with an unlocked dependency should fail with --no-update-lock-file. +nix build -o $TEST_ROOT/result $flake2Dir#bar --no-update-lock-file 2>&1 | grep 'requires lock file changes' + +# But it should succeed without that flag. +nix build -o $TEST_ROOT/result $flake2Dir#bar --no-write-lock-file +nix build -o $TEST_ROOT/result $flake2Dir#bar --no-update-lock-file 2>&1 | grep 'requires lock file changes' nix build -o $TEST_ROOT/result $flake2Dir#bar [[ -e $flake2Dir/flake.lock ]] git -C $flake2Dir add flake.lock |