mirror of
https://github.com/NixOS/nix
synced 2025-07-07 22:33:57 +02:00
nix-shell/nix-build: Support .drv files again
Fixes #1663. Also handle '!<output-name>' (#1694).
This commit is contained in:
parent
0fc3e581e0
commit
90948a4e3a
6 changed files with 61 additions and 4 deletions
|
@ -2,6 +2,8 @@ source common.sh
|
|||
|
||||
clearStore
|
||||
|
||||
rm -f $TEST_ROOT/result*
|
||||
|
||||
# Test whether read-only evaluation works when referring to the
|
||||
# ‘drvPath’ attribute.
|
||||
echo "evaluating c..."
|
||||
|
@ -28,7 +30,7 @@ echo "output path is $outPath"
|
|||
[ "$(cat "$outPath"/file)" = "success" ]
|
||||
|
||||
# Test nix-build on a derivation with multiple outputs.
|
||||
nix-build multiple-outputs.nix -A a -o $TEST_ROOT/result
|
||||
outPath1=$(nix-build multiple-outputs.nix -A a -o $TEST_ROOT/result)
|
||||
[ -e $TEST_ROOT/result-first ]
|
||||
(! [ -e $TEST_ROOT/result-second ])
|
||||
nix-build multiple-outputs.nix -A a.all -o $TEST_ROOT/result
|
||||
|
@ -37,6 +39,17 @@ nix-build multiple-outputs.nix -A a.all -o $TEST_ROOT/result
|
|||
[ "$(cat $TEST_ROOT/result-second/link/file)" = "first" ]
|
||||
hash1=$(nix-store -q --hash $TEST_ROOT/result-second)
|
||||
|
||||
outPath2=$(nix-build $(nix-instantiate multiple-outputs.nix -A a) --no-out-link)
|
||||
[[ $outPath1 = $outPath2 ]]
|
||||
|
||||
outPath2=$(nix-build $(nix-instantiate multiple-outputs.nix -A a.first) --no-out-link)
|
||||
[[ $outPath1 = $outPath2 ]]
|
||||
|
||||
outPath2=$(nix-build $(nix-instantiate multiple-outputs.nix -A a.second) --no-out-link)
|
||||
[[ $(cat $outPath2/file) = second ]]
|
||||
|
||||
[[ $(nix-build $(nix-instantiate multiple-outputs.nix -A a.all) --no-out-link | wc -l) -eq 2 ]]
|
||||
|
||||
# Delete one of the outputs and rebuild it. This will cause a hash
|
||||
# rewrite.
|
||||
nix-store --delete $TEST_ROOT/result-second --ignore-liveness
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue