1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-10 04:43:53 +02:00

skip ifds in nix flake show instead of throwing

This commit is contained in:
Uluc Sengil 2025-02-28 19:53:41 +01:00 committed by Jörg Thalheim
parent 77f22db567
commit fcf5966488
6 changed files with 69 additions and 15 deletions

View file

@ -88,6 +88,19 @@ writeDependentFlake() {
EOF
}
writeIfdFlake() {
local flakeDir="$1"
cat > "$flakeDir/flake.nix" <<EOF
{
outputs = { self }: {
packages.$system.default = import ./ifd.nix;
};
}
EOF
cp -n ../ifd.nix ../dependencies.nix ../dependencies.builder0.sh "${config_nix}" "$flakeDir/"
}
writeTrivialFlake() {
local flakeDir="$1"
cat > "$flakeDir/flake.nix" <<EOF

View file

@ -6,7 +6,7 @@ flakeDir=$TEST_ROOT/flake
mkdir -p "$flakeDir"
writeSimpleFlake "$flakeDir"
cd "$flakeDir"
pushd "$flakeDir"
# By default: Only show the packages content for the current system and no
@ -87,3 +87,18 @@ assert show_output.legacyPackages.${builtins.currentSystem}.AAAAAASomeThingsFail
assert show_output.legacyPackages.${builtins.currentSystem}.simple.name == "simple";
true
'
# Test that nix flake show doesn't fail if one of the outputs contains
# an IFD
popd
writeIfdFlake $flakeDir
pushd $flakeDir
nix flake show --json > show-output.json
nix eval --impure --expr '
let show_output = builtins.fromJSON (builtins.readFile ./show-output.json);
in
assert show_output.packages.${builtins.currentSystem}.default == { };
true
'