Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 16 additions & 9 deletions pkgs/build-support/buildenv/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -88,30 +88,37 @@ lib.makeOverridable (
lib.flatten
(lib.remove null)
];

pkgs = builtins.toJSON chosenOutputs;
in
runCommand name
(
rec {
{
env = {
inherit
pkgs
extraPrefix
ignoreCollisions
checkCollisionContents
ignoreSingleFileOutputs
manifest
;
pathsToLinkJSON = builtins.toJSON pathsToLink;
extraPathsFrom = toString (lib.optional includeClosures (writeClosure pathsForClosure));
};
Comment on lines +97 to +108
Copy link
Contributor

@ShamrockLee ShamrockLee Dec 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From PR #432957's perspective, referencing from finalAttrs.env.ignoreCollisions is much less intuitive compared to finalAttrs.ignoreCollisions.

In addition, the custom override overrider is prone to be overridden by callPackage-provided <pkg>.override when defining a package, and should be replaced by <pkg>.overrideAttrs. Again, overriding env.ignoreCollisions is less intuitive than overriding ignoreCollisions.

Perl has powerful built-in JSON-parsing support, which we are using to parse chosenOutputs (currently stringified as the pkgs attribute). Why not parsing $NIX_ATTRS_JSON_FILE?

COI disclosure: I'm the author of competing PR:

inherit
manifest
ignoreCollisions
checkCollisionContents
ignoreSingleFileOutputs
passthru
meta
pathsToLink
extraPrefix
postBuild
nativeBuildInputs
buildInputs
;
pathsToLinkJSON = builtins.toJSON pathsToLink;
pkgs = builtins.toJSON chosenOutputs;
extraPathsFrom = lib.optional includeClosures (writeClosure pathsForClosure);
preferLocalBuild = true;
allowSubstitutes = false;
# XXX: The size is somewhat arbitrary
passAsFile = if builtins.stringLength pkgs >= 128 * 1024 then [ "pkgs" ] else [ ];
__structuredAttrs = true;
}
// lib.optionalAttrs (pname != null) {
inherit pname;
Expand Down
Loading