···134 "__darwinAllowLocalNetworking"
135 "__impureHostDeps" "__propagatedImpureHostDeps"
136 "sandboxProfile" "propagatedSandboxProfile"
00137 ];
138139 # Turn a derivation into its outPath without a string context attached.
···142 if isDerivation drv && (!drv.__contentAddressed or false)
143 then builtins.unsafeDiscardStringContext drv.outPath
144 else drv;
000000000000000000000000000000000000145146 makeDerivationArgument =
147···455 "/bin/sh"
456 ];
457 __propagatedImpureHostDeps = computedPropagatedImpureHostDeps ++ __propagatedImpureHostDeps;
458- }) //
459- # If we use derivations directly here, they end up as build-time dependencies.
460- # This is especially problematic in the case of disallowed*, since the disallowed
461- # derivations will be built by nix as build-time dependencies, while those
462- # derivations might take a very long time to build, or might not even build
463- # successfully on the platform used.
464- # We can improve on this situation by instead passing only the outPath,
465- # without an attached string context, to nix. The out path will be a placeholder
466- # which will be replaced by the actual out path if the derivation in question
467- # is part of the final closure (and thus needs to be built). If it is not
468- # part of the final closure, then the placeholder will be passed along,
469- # but in that case we know for a fact that the derivation is not part of the closure.
470- # This means that passing the out path to nix does the right thing in either
471- # case, both for disallowed and allowed references/requisites, and we won't
472- # build the derivation if it wouldn't be part of the closure, saving time and resources.
473- # While the problem is less severe for allowed*, since we want the derivation
474- # to be built eventually, we would still like to get the error early and without
475- # having to wait while nix builds a derivation that might not be used.
476- # See also https://github.com/NixOS/nix/issues/4629
477- optionalAttrs (attrs ? disallowedReferences) {
478- disallowedReferences =
479- map unsafeDerivationToUntrackedOutpath attrs.disallowedReferences;
480- } //
481- optionalAttrs (attrs ? disallowedRequisites) {
482- disallowedRequisites =
483- map unsafeDerivationToUntrackedOutpath attrs.disallowedRequisites;
484- } //
485- optionalAttrs (attrs ? allowedReferences) {
486- allowedReferences =
487- mapNullable unsafeDerivationToUntrackedOutpath attrs.allowedReferences;
488- } //
489- optionalAttrs (attrs ? allowedRequisites) {
490- allowedRequisites =
491- mapNullable unsafeDerivationToUntrackedOutpath attrs.allowedRequisites;
492 };
493494in
···134 "__darwinAllowLocalNetworking"
135 "__impureHostDeps" "__propagatedImpureHostDeps"
136 "sandboxProfile" "propagatedSandboxProfile"
137+ "disallowedReferences" "disallowedRequisites"
138+ "allowedReferences" "allowedRequisites"
139 ];
140141 # Turn a derivation into its outPath without a string context attached.
···144 if isDerivation drv && (!drv.__contentAddressed or false)
145 then builtins.unsafeDiscardStringContext drv.outPath
146 else drv;
147+148+ makeOutputChecks = attrs:
149+ # If we use derivations directly here, they end up as build-time dependencies.
150+ # This is especially problematic in the case of disallowed*, since the disallowed
151+ # derivations will be built by nix as build-time dependencies, while those
152+ # derivations might take a very long time to build, or might not even build
153+ # successfully on the platform used.
154+ # We can improve on this situation by instead passing only the outPath,
155+ # without an attached string context, to nix. The out path will be a placeholder
156+ # which will be replaced by the actual out path if the derivation in question
157+ # is part of the final closure (and thus needs to be built). If it is not
158+ # part of the final closure, then the placeholder will be passed along,
159+ # but in that case we know for a fact that the derivation is not part of the closure.
160+ # This means that passing the out path to nix does the right thing in either
161+ # case, both for disallowed and allowed references/requisites, and we won't
162+ # build the derivation if it wouldn't be part of the closure, saving time and resources.
163+ # While the problem is less severe for allowed*, since we want the derivation
164+ # to be built eventually, we would still like to get the error early and without
165+ # having to wait while nix builds a derivation that might not be used.
166+ # See also https://github.com/NixOS/nix/issues/4629
167+ optionalAttrs (attrs ? disallowedReferences) {
168+ disallowedReferences =
169+ map unsafeDerivationToUntrackedOutpath attrs.disallowedReferences;
170+ } //
171+ optionalAttrs (attrs ? disallowedRequisites) {
172+ disallowedRequisites =
173+ map unsafeDerivationToUntrackedOutpath attrs.disallowedRequisites;
174+ } //
175+ optionalAttrs (attrs ? allowedReferences) {
176+ allowedReferences =
177+ mapNullable unsafeDerivationToUntrackedOutpath attrs.allowedReferences;
178+ } //
179+ optionalAttrs (attrs ? allowedRequisites) {
180+ allowedRequisites =
181+ mapNullable unsafeDerivationToUntrackedOutpath attrs.allowedRequisites;
182+ };
183184 makeDerivationArgument =
185···493 "/bin/sh"
494 ];
495 __propagatedImpureHostDeps = computedPropagatedImpureHostDeps ++ __propagatedImpureHostDeps;
496+ }) // lib.optionalAttrs (!__structuredAttrs) (
497+ makeOutputChecks attrs
498+ ) // lib.optionalAttrs (__structuredAttrs) {
499+ outputChecks = builtins.listToAttrs (map (name: {
500+ inherit name;
501+ value = lib.zipAttrsWith (_: builtins.concatLists) [
502+ (makeOutputChecks attrs)
503+ (makeOutputChecks attrs.outputChecks.${name} or {})
504+ ];
505+ }) outputs);
000000000000000000000000506 };
507508in