From cb39a53e9f424742e4ed816d0f7c428f0859bf7b Mon Sep 17 00:00:00 2001 From: Yueh-Shun Li Date: Fri, 19 Dec 2025 21:56:01 +0800 Subject: [PATCH] testers.invalidateFetcherByDrvHash: salt pname if presented --- pkgs/build-support/testers/default.nix | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pkgs/build-support/testers/default.nix b/pkgs/build-support/testers/default.nix index ac31c22ab4a2..f82c41c7fe5b 100644 --- a/pkgs/build-support/testers/default.nix +++ b/pkgs/build-support/testers/default.nix @@ -135,8 +135,15 @@ drvPath = (f args).drvPath; # It's safe to discard the context, because we don't access the path. salt = builtins.unsafeDiscardStringContext (lib.substring 0 12 (baseNameOf drvPath)); + saltName = name: "${name}-salted-${salt}"; + getSaltedNames = + args: + if args.pname or null != null then + { pname = saltName args.pname; } + else + { name = saltName args.name or "source"; }; # New derivation incorporating the original drv hash in the name - salted = f (args // { name = "${args.name or "source"}-salted-${salt}"; }); + salted = f (args // getSaltedNames args); # Make sure we did change the derivation. If the fetcher ignores `name`, # `invalidateFetcherByDrvHash` doesn't work. checked =