1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-03-18 06:18:14 +00:00

tests: expose scrubDerivation

Will use it with darwin scrubbing
This commit is contained in:
Austin Horstman 2025-03-09 00:11:21 -06:00
parent 72580374c8
commit b74402e4e8

View file

@ -14,35 +14,33 @@ let
# `"@package-name@"`. This allows the tests to refer to derivations through # `"@package-name@"`. This allows the tests to refer to derivations through
# their values without establishing an actual dependency on the derivation # their values without establishing an actual dependency on the derivation
# output. # output.
scrubDerivations = attrs: scrubDerivation = name: value:
let let
scrubDerivation = name: value: scrubbedValue = scrubDerivations value;
let
scrubbedValue = scrubDerivations value;
newDrvAttrs = { newDrvAttrs = {
buildScript = abort "no build allowed"; buildScript = abort "no build allowed";
outPath = builtins.traceVerbose ("${name} - got out path") outPath = builtins.traceVerbose "${name} - got out path"
"@${lib.getName value}@"; "@${lib.getName value}@";
# Prevent getOutput from descending into outputs # Prevent getOutput from descending into outputs
outputSpecified = true; outputSpecified = true;
# Allow the original package to be used in derivation inputs # Allow the original package to be used in derivation inputs
__spliced = { __spliced = {
buildHost = value; buildHost = value;
hostTarget = value; hostTarget = value;
}; };
}; };
in if lib.isAttrs value then in if lib.isAttrs value then
if lib.isDerivation value then if lib.isDerivation value then
scrubbedValue // newDrvAttrs scrubbedValue // newDrvAttrs
else else
scrubbedValue scrubbedValue
else else
value; value;
in lib.mapAttrs scrubDerivation attrs; scrubDerivations = attrs: let in lib.mapAttrs scrubDerivation attrs;
# Globally unscrub a few selected packages that are used by a wide selection of tests. # Globally unscrub a few selected packages that are used by a wide selection of tests.
whitelist = let whitelist = let