mirror of
https://github.com/NixOS/nix
synced 2025-07-08 11:03:54 +02:00
add nix-store --query --valid-derivers command
notably useful when nix-store --query --deriver returns a non-existing path. Co-authored-by: Felix Uhl <iFreilicht@users.noreply.github.com>
This commit is contained in:
parent
6459a1c7ad
commit
925a444b92
9 changed files with 68 additions and 10 deletions
|
@ -53,3 +53,20 @@ nix-store -q --referrers-closure "$input2OutPath" | grep "$outPath"
|
|||
# Check that the derivers are set properly.
|
||||
test $(nix-store -q --deriver "$outPath") = "$drvPath"
|
||||
nix-store -q --deriver "$input2OutPath" | grepQuiet -- "-input-2.drv"
|
||||
|
||||
# --valid-derivers returns the currently single valid .drv file
|
||||
test "$(nix-store -q --valid-derivers "$outPath")" = "$drvPath"
|
||||
|
||||
# instantiate a different drv with the same output
|
||||
drvPath2=$(nix-instantiate dependencies.nix --argstr hashInvalidator yay)
|
||||
|
||||
# now --valid-derivers returns both
|
||||
test "$(nix-store -q --valid-derivers "$outPath" | sort)" = "$(sort <<< "$drvPath"$'\n'"$drvPath2")"
|
||||
|
||||
# check that nix-store --valid-derivers only returns existing drv
|
||||
nix-store --delete "$drvPath"
|
||||
test "$(nix-store -q --valid-derivers "$outPath")" = "$drvPath2"
|
||||
|
||||
# check that --valid-derivers returns nothing when there are no valid derivers
|
||||
nix-store --delete "$drvPath2"
|
||||
test -z "$(nix-store -q --valid-derivers "$outPath")"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue