mirror of
https://github.com/NixOS/nix
synced 2025-07-08 06:53:54 +02:00
Catch eval errors in hasContent
`legacyPackages` of nixpkgs trigger eval errors in `hasContent`, causing the whole `legacyPackages` being skipped. We should treat it as has-content in that case.
This commit is contained in:
parent
e00abd3f56
commit
2941a599fa
2 changed files with 51 additions and 24 deletions
|
@ -64,3 +64,23 @@ in
|
|||
assert show_output == { };
|
||||
true
|
||||
'
|
||||
|
||||
# Test that legacyPackages with errors are handled correctly.
|
||||
cat >flake.nix <<EOF
|
||||
{
|
||||
outputs = inputs: {
|
||||
legacyPackages.$system = {
|
||||
AAAAAASomeThingsFailToEvaluate = throw "nooo";
|
||||
simple = import ./simple.nix;
|
||||
};
|
||||
};
|
||||
}
|
||||
EOF
|
||||
nix flake show --json --legacy --all-systems > show-output.json
|
||||
nix eval --impure --expr '
|
||||
let show_output = builtins.fromJSON (builtins.readFile ./show-output.json);
|
||||
in
|
||||
assert show_output.legacyPackages.${builtins.currentSystem}.AAAAAASomeThingsFailToEvaluate == { };
|
||||
assert show_output.legacyPackages.${builtins.currentSystem}.simple.name == "simple";
|
||||
true
|
||||
'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue