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.
This commit is contained in:
sternenseemann 2021-10-06 11:42:03 +02:00 committed by sterni
parent 6bfc5e94f6
commit 9a76986ee0

View File

@ -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; {