From a16d82151499bc3ecf6dc66f16275620052c7216 Mon Sep 17 00:00:00 2001 From: Philip Taron Date: Thu, 18 Sep 2025 11:17:49 -0700 Subject: [PATCH] pkgs/top-level/metrics.nix: fix the jq to count derivations As can be seen on https://hydra.nixos.org/job/nixpkgs/trunk/metrics/metric/nix-env.qaCountBroken the logic is counting `null` entries today. I introduced this regression in dfd90bf4c07b6eb3d101190c2ad2369c92ea52d5 --- pkgs/top-level/metrics.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/top-level/metrics.nix b/pkgs/top-level/metrics.nix index c6380b74a667..574e8f510a8b 100644 --- a/pkgs/top-level/metrics.nix +++ b/pkgs/top-level/metrics.nix @@ -93,7 +93,7 @@ stdenvNoCC.mkDerivation { # It's slightly unclear which of the set to track: qaCount, qaCountDrv, qaCountBroken. num="$(wc -l < metrics/nix-env.qa/output)" echo "nix-env.qaCount $num" >> hydra-metrics - qaCountDrv="$(jq -r 'reduce .[].drvPath as $d (0; .+1)' metrics/nix-env.qaDrv/output)" + qaCountDrv="$(jq -r 'reduce (.[].drvPath? // empty) as $d (0; .+1)' metrics/nix-env.qaDrv/output)" numBroken="$((num - $qaCountDrv))" echo "nix-env.qaCountBroken $numBroken" >> hydra-metrics