mirror of
https://github.com/NixOS/nix
synced 2025-06-25 10:41:16 +02:00
tests/functional/flakes/non-flake-inputs: Test non-flake inputs having sourceInfo
This commit is contained in:
parent
eaee0b4740
commit
72232bc28a
1 changed files with 46 additions and 0 deletions
|
@ -37,11 +37,20 @@ cat > "$flake3Dir/flake.nix" <<EOF
|
||||||
url = "$nonFlakeDir/README.md";
|
url = "$nonFlakeDir/README.md";
|
||||||
flake = false;
|
flake = false;
|
||||||
};
|
};
|
||||||
|
nonFlakeFile3 = {
|
||||||
|
url = "$nonFlakeDir?dir=README.md";
|
||||||
|
flake = false;
|
||||||
|
};
|
||||||
|
relativeNonFlakeFile = {
|
||||||
|
url = ./config.nix;
|
||||||
|
flake = false;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
description = "Fnord";
|
description = "Fnord";
|
||||||
|
|
||||||
outputs = inputs: rec {
|
outputs = inputs: rec {
|
||||||
|
inherit inputs;
|
||||||
packages.$system.xyzzy = inputs.flake2.packages.$system.bar;
|
packages.$system.xyzzy = inputs.flake2.packages.$system.bar;
|
||||||
packages.$system.sth = inputs.flake1.packages.$system.foo;
|
packages.$system.sth = inputs.flake1.packages.$system.foo;
|
||||||
packages.$system.fnord =
|
packages.$system.fnord =
|
||||||
|
@ -88,6 +97,43 @@ mv "$flake2Dir.tmp" "$flake2Dir"
|
||||||
mv "$nonFlakeDir.tmp" "$nonFlakeDir"
|
mv "$nonFlakeDir.tmp" "$nonFlakeDir"
|
||||||
nix build -o "$TEST_ROOT/result" flake3#xyzzy flake3#fnord
|
nix build -o "$TEST_ROOT/result" flake3#xyzzy flake3#fnord
|
||||||
|
|
||||||
|
# Check non-flake inputs have a sourceInfo and an outPath
|
||||||
|
#
|
||||||
|
# This may look redundant, but the other checks below happen in a command
|
||||||
|
# substitution subshell, so failures there will not exit this shell
|
||||||
|
nix eval --raw flake3#inputs.nonFlake.outPath
|
||||||
|
nix eval --raw flake3#inputs.nonFlake.sourceInfo.outPath
|
||||||
|
nix eval --raw flake3#inputs.nonFlakeFile.outPath
|
||||||
|
nix eval --raw flake3#inputs.nonFlakeFile.sourceInfo.outPath
|
||||||
|
nix eval --raw flake3#inputs.nonFlakeFile2.outPath
|
||||||
|
nix eval --raw flake3#inputs.nonFlakeFile2.sourceInfo.outPath
|
||||||
|
nix eval --raw flake3#inputs.nonFlakeFile3.outPath
|
||||||
|
nix eval --raw flake3#inputs.nonFlakeFile3.sourceInfo.outPath
|
||||||
|
nix eval --raw flake3#inputs.relativeNonFlakeFile.outPath
|
||||||
|
nix eval --raw flake3#inputs.relativeNonFlakeFile.sourceInfo.outPath
|
||||||
|
|
||||||
|
# Check non-flake file inputs have the expected outPaths
|
||||||
|
[[
|
||||||
|
$(nix eval --raw flake3#inputs.nonFlake.outPath) \
|
||||||
|
= $(nix eval --raw flake3#inputs.nonFlake.sourceInfo.outPath)
|
||||||
|
]]
|
||||||
|
[[
|
||||||
|
$(nix eval --raw flake3#inputs.nonFlakeFile.outPath) \
|
||||||
|
= $(nix eval --raw flake3#inputs.nonFlakeFile.sourceInfo.outPath)
|
||||||
|
]]
|
||||||
|
[[
|
||||||
|
$(nix eval --raw flake3#inputs.nonFlakeFile2.outPath) \
|
||||||
|
= $(nix eval --raw flake3#inputs.nonFlakeFile2.sourceInfo.outPath)
|
||||||
|
]]
|
||||||
|
[[
|
||||||
|
$(nix eval --raw flake3#inputs.nonFlakeFile3.outPath) \
|
||||||
|
= $(nix eval --raw flake3#inputs.nonFlakeFile3.sourceInfo.outPath)/README.md
|
||||||
|
]]
|
||||||
|
[[
|
||||||
|
$(nix eval --raw flake3#inputs.relativeNonFlakeFile.outPath) \
|
||||||
|
= $(nix eval --raw flake3#inputs.relativeNonFlakeFile.sourceInfo.outPath)/config.nix
|
||||||
|
]]
|
||||||
|
|
||||||
# Make branch "removeXyzzy" where flake3 doesn't have xyzzy anymore
|
# Make branch "removeXyzzy" where flake3 doesn't have xyzzy anymore
|
||||||
git -C "$flake3Dir" checkout -b removeXyzzy
|
git -C "$flake3Dir" checkout -b removeXyzzy
|
||||||
rm "$flake3Dir/flake.nix"
|
rm "$flake3Dir/flake.nix"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue