1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-14 14:32:42 +01:00

Merge pull request #14321 from roberth/nix-flake-check-track-attribute

Track attributes in `nix flake check`
This commit is contained in:
tomberek 2025-11-10 17:32:10 +00:00 committed by GitHub
commit 7a60f1429f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 55 additions and 5 deletions

View file

@ -192,3 +192,24 @@ EOF
# shellcheck disable=SC2015
checkRes=$(nix flake check "$flakeDir" 2>&1 && fail "nix flake check should have failed" || true)
echo "$checkRes" | grepQuiet -E "builder( for .*)? failed with exit code 1"
# Test that attribute paths are shown in error messages
cat > "$flakeDir"/flake.nix <<EOF
{
outputs = { self }: with import ./config.nix; {
checks.${system}.failingCheck = mkDerivation {
name = "failing-check";
buildCommand = "echo 'This check fails'; exit 1";
};
checks.${system}.anotherFailingCheck = mkDerivation {
name = "another-failing-check";
buildCommand = "echo 'This also fails'; exit 1";
};
};
}
EOF
# shellcheck disable=SC2015
checkRes=$(nix flake check --keep-going "$flakeDir" 2>&1 && fail "nix flake check should have failed" || true)
echo "$checkRes" | grepQuiet "checks.${system}.failingCheck"
echo "$checkRes" | grepQuiet "checks.${system}.anotherFailingCheck"