diff --git a/pkgs/stdenv/generic/make-derivation.nix b/pkgs/stdenv/generic/make-derivation.nix index 8ae991cb53661..673a2676a19f5 100644 --- a/pkgs/stdenv/generic/make-derivation.nix +++ b/pkgs/stdenv/generic/make-derivation.nix @@ -878,8 +878,7 @@ let inputDerivation = derivation ( deleteFixedOutputRelatedAttrs derivationArg // { - # Add a name in case the original drv didn't have one - name = derivationArg.name or "inputDerivation"; + name = "inputDerivation${lib.optionalString (derivationArg ? name) "-${derivationArg.name}"}"; # This always only has one output outputs = [ "out" ]; @@ -912,23 +911,20 @@ let ]; } // ( - let - sharedOutputChecks = { - # inputDerivation produces the inputs; not the outputs, so any - # restrictions on what used to be the outputs don't serve a purpose - # anymore. + # inputDerivation produces the inputs; not the outputs, so any + # restrictions on what used to be the outputs don't serve a purpose + # anymore. + if __structuredAttrs then + { + outputChecks = { }; + } + else + { allowedReferences = null; allowedRequisites = null; disallowedReferences = [ ]; disallowedRequisites = [ ]; - }; - in - if __structuredAttrs then - { - outputChecks.out = sharedOutputChecks; } - else - sharedOutputChecks ) ); diff --git a/pkgs/test/stdenv/default.nix b/pkgs/test/stdenv/default.nix index cf09258d6fbc0..7688b39b5aa73 100644 --- a/pkgs/test/stdenv/default.nix +++ b/pkgs/test/stdenv/default.nix @@ -355,6 +355,10 @@ in touch $out ''; + test-inputDerivation-structured = (stdenv.mkDerivation { + __structuredAttrs = true; + }).inputDerivation; + test-prepend-append-to-var = testPrependAndAppendToVar { name = "test-prepend-append-to-var"; stdenv' = bootStdenv;