mirror of
https://github.com/nix-community/home-manager.git
synced 2026-06-05 21:02:51 +00:00
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:
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user