From c4fa63da496154e74c8fa790a7a9d42f1a4d94ca Mon Sep 17 00:00:00 2001 From: Wolfgang Walther Date: Wed, 20 Aug 2025 12:49:57 +0200 Subject: [PATCH] ci/nixpkgs-vet: memoize filesets Speeds up evaluation a bit, because `filtered head` doesn't need to be evaluated 3x. --- ci/nixpkgs-vet.nix | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/ci/nixpkgs-vet.nix b/ci/nixpkgs-vet.nix index 58b5024589bd..d3103579730d 100644 --- a/ci/nixpkgs-vet.nix +++ b/ci/nixpkgs-vet.nix @@ -16,6 +16,9 @@ let fileset = (gitTracked path); root = path; }; + + filteredBase = filtered base; + filteredHead = filtered head; in runCommand "nixpkgs-vet" { @@ -27,11 +30,11 @@ runCommand "nixpkgs-vet" '' export NIX_STATE_DIR=$(mktemp -d) - nixpkgs-vet --base ${filtered base} ${filtered head} + nixpkgs-vet --base ${filteredBase} ${filteredHead} # TODO: Upstream into nixpkgs-vet, see: # https://github.com/NixOS/nixpkgs-vet/issues/164 - badFiles=$(find ${filtered head}/pkgs -type f -name '*.nix' -print | xargs grep -l '^[^#]* to refer to itself." echo "The offending files:" @@ -41,7 +44,7 @@ runCommand "nixpkgs-vet" # TODO: Upstream into nixpkgs-vet, see: # https://github.com/NixOS/nixpkgs-vet/issues/166 - conflictingPaths=$(find ${filtered head} | awk '{ print $1 " " tolower($1) }' | sort -k2 | uniq -D -f 1 | cut -d ' ' -f 1) + conflictingPaths=$(find ${filteredHead} | awk '{ print $1 " " tolower($1) }' | sort -k2 | uniq -D -f 1 | cut -d ' ' -f 1) if [[ -n $conflictingPaths ]]; then echo "Files in nixpkgs must not vary only by case." echo "The offending paths:"