tests: split stub derivation attrs from methods

Apply non-function stub attributes through overrideAttrs so derivation metadata and wrapper-facing fields remain visible to downstream consumers.

Keep function-valued attributes like override on the outer attrset so they are not serialized into derivations and do not break unrelated tests.
This commit is contained in:
Austin Horstman
2026-04-23 17:57:30 -05:00
parent 5a9efa93c5
commit bb0aaf91cc

View File

@@ -64,8 +64,19 @@ let
meta.mainProgram = name;
} buildScript;
drvExtraAttrs = lib.filterAttrs (_: v: !lib.isFunction v) extraAttrs;
outerExtraAttrs = lib.filterAttrs (_: lib.isFunction) extraAttrs;
overriddenPkg =
if drvExtraAttrs == { } then
pkg
else
pkg.overrideAttrs (old: lib.recursiveUpdate old drvExtraAttrs);
stubbedPkg =
pkg
overriddenPkg
// outerExtraAttrs
// lib.optionalAttrs (outPath != null) {
inherit outPath;
@@ -74,12 +85,11 @@ let
# Allow the original package to be used in derivation inputs
__spliced = {
buildHost = pkg;
hostTarget = pkg;
buildHost = overriddenPkg;
hostTarget = overriddenPkg;
};
}
// lib.optionalAttrs (version != null) { inherit version; }
// extraAttrs;
// lib.optionalAttrs (version != null) { inherit version; };
in
stubbedPkg;