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

Merge pull request #12583 from ulucs/ulucs/skip-ifds

`nix flake show`: Skip IFDs instead of throwing
This commit is contained in:
Jörg Thalheim 2025-03-27 11:40:49 +01:00 committed by GitHub
commit ca165f09c0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
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
'