···274274 "__darwinAllowLocalNetworking"
275275 "__impureHostDeps" "__propagatedImpureHostDeps"
276276 "sandboxProfile" "propagatedSandboxProfile"]
277277- ++ lib.optionals envIsExportable [ "env" ]))
277277+ ++ lib.optional (__structuredAttrs || envIsExportable) "env"))
278278 // (lib.optionalAttrs (attrs ? name || (attrs ? pname && attrs ? version)) {
279279 name =
280280 let
···298298 then attrs.name + hostSuffix
299299 else "${attrs.pname}${staticMarker}${hostSuffix}-${attrs.version}"
300300 );
301301- }) // lib.optionalAttrs (envIsExportable && __structuredAttrs) { env = checkedEnv; } // {
301301+ }) // lib.optionalAttrs __structuredAttrs { env = checkedEnv; } // {
302302 builder = attrs.realBuilder or stdenv.shell;
303303 args = attrs.args or ["-e" (attrs.builder or ./default-builder.sh)];
304304 inherit stdenv;
···485485 let
486486 overlappingNames = lib.intersectLists (lib.attrNames env) (lib.attrNames derivationArg);
487487 in
488488+ assert lib.assertMsg envIsExportable
489489+ "When using structured attributes, `env` must be an attribute set of environment variables.";
488490 assert lib.assertMsg (overlappingNames == [ ])
489491 "The ‘env’ attribute set cannot contain any attributes passed to derivation. The following attributes are overlapping: ${lib.concatStringsSep ", " overlappingNames}";
490492 lib.mapAttrs
+7-4
pkgs/stdenv/generic/setup.sh
···383383######################################################################
384384# Initialisation.
385385386386-# export all vars that should be in the ENV
387387-for envVar in "${!env[@]}"; do
388388- declare -x "${envVar}=${env[${envVar}]}"
389389-done
386386+# If using structured attributes, export variables from `env` to the environment.
387387+# When not using structured attributes, those variables are already exported.
388388+if [[ -n $__structuredAttrs ]]; then
389389+ for envVar in "${!env[@]}"; do
390390+ declare -x "${envVar}=${env[${envVar}]}"
391391+ done
392392+fi
390393391394392395# Set a fallback default value for SOURCE_DATE_EPOCH, used by some build tools