From 9a76986ee0d46ea8074c9a8992df531dd90ac261 Mon Sep 17 00:00:00 2001 From: sternenseemann Date: Wed, 6 Oct 2021 11:42:03 +0200 Subject: foot: cache stimuliFile more aggressively stimuliFile would get rebuild with every change in version, since the stimulusGenerator derivation would depend on the version string. Since the script often doesn't change between releases, this causes unnecessary rebuilds and cache duplication. Additionally we add a test to passthru which checks if the hash of the script is still up to date: By making its name depend on the version string, it'll get rebuild on every version change, even if the hash stays the same. This way we can detect new hash mismatches. --- pkgs/applications/terminal-emulators/foot/default.nix | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'pkgs/applications/terminal-emulators') diff --git a/pkgs/applications/terminal-emulators/foot/default.nix b/pkgs/applications/terminal-emulators/foot/default.nix index f9fea74c113d9..837b2b45a391e 100644 --- a/pkgs/applications/terminal-emulators/foot/default.nix +++ b/pkgs/applications/terminal-emulators/foot/default.nix @@ -36,8 +36,7 @@ let # # For every bump, make sure that the hash is still accurate. stimulusGenerator = stdenv.mkDerivation { - pname = "foot-generate-alt-random-writes"; - inherit version; + name = "foot-generate-alt-random-writes"; src = fetchurl { url = "https://codeberg.org/dnkl/foot/raw/tag/${version}/scripts/generate-alt-random-writes.py"; @@ -185,6 +184,13 @@ stdenv.mkDerivation rec { noPgo = foot.override { allowPgo = false; }; + + # By changing name, this will get rebuilt everytime we change version, + # even if the hash stays the same. Consequently it'll fail if we introduce + # a hash mismatch when updating. + stimulus-script-is-current = stimulusGenerator.src.overrideAttrs (_: { + name = "generate-alt-random-writes-${version}.py"; + }); }; meta = with lib; { -- cgit 1.4.1