buildEnv: reference attributes from finalAttrs

This commit is contained in:
Yueh-Shun Li
2026-03-19 13:17:19 -07:00
committed by Philip Taron
parent 726999375d
commit ae8cb8c65e
+18 -6
View File
@@ -93,9 +93,12 @@ lib.makeOverridable (
[ drv ]
)
# Add any extra outputs specified by the caller of `buildEnv`.
++ lib.filter (p: p != null) (map (outName: drv.${outName} or null) extraOutputsToInstall);
++ lib.filter (p: p != null) (
map (outName: drv.${outName} or null) finalAttrs.extraOutputsToInstall
);
priority = drv.meta.priority or lib.meta.defaultPriority;
}) paths;
# Silently use the original `paths` if `passthru.paths` is missing.
}) finalAttrs.passthru.paths or paths;
pathsForClosure = lib.pipe chosenOutputs [
(map (p: p.paths))
@@ -103,13 +106,14 @@ lib.makeOverridable (
(lib.remove null)
];
in
rec {
{
inherit
extraOutputsToInstall
manifest
ignoreCollisions
checkCollisionContents
ignoreSingleFileOutputs
passthru
includeClosures
meta
pathsToLink
extraPrefix
@@ -119,19 +123,27 @@ lib.makeOverridable (
;
pathsToLinkJSON = builtins.toJSON pathsToLink;
pkgs = builtins.toJSON chosenOutputs;
extraPathsFrom = lib.optionalString includeClosures (writeClosure pathsForClosure);
extraPathsFrom = lib.optionalString finalAttrs.includeClosures (writeClosure pathsForClosure);
preferLocalBuild = true;
allowSubstitutes = false;
passAsFile = [
"buildCommand"
]
# XXX: The size is somewhat arbitrary
++ lib.optional (lib.stringLength pkgs >= 128 * 1024) "pkgs";
++ lib.optional (lib.stringLength finalAttrs.pkgs >= 128 * 1024) "pkgs";
buildCommand = ''
${buildPackages.perl}/bin/perl -w ${builder}
eval "$postBuild"
'';
passthru = {
# Attributes to override from passthru
inherit
paths
;
}
// passthru;
};
# Function argument set pattern doesn't have an ellipsis