diff --git a/pkgs/stdenv/generic/make-derivation.nix b/pkgs/stdenv/generic/make-derivation.nix index 2145b5640177f..0a512f703b495 100644 --- a/pkgs/stdenv/generic/make-derivation.nix +++ b/pkgs/stdenv/generic/make-derivation.nix @@ -15,6 +15,7 @@ let elemAt extendDerivation filter + filterAttrs getDev head imap1 @@ -709,8 +710,12 @@ let ]; } // ( + let + attrsOutputChecks = makeOutputChecks attrs; + attrsOutputChecksFiltered = filterAttrs (_: v: v != null) attrsOutputChecks; + in if !__structuredAttrs then - makeOutputChecks attrs + attrsOutputChecks else { outputChecks = builtins.listToAttrs ( @@ -719,7 +724,7 @@ let value = let raw = zipAttrsWith (_: builtins.concatLists) [ - (makeOutputChecks attrs) + attrsOutputChecksFiltered (makeOutputChecks attrs.outputChecks.${name} or { }) ]; in diff --git a/pkgs/test/overriding.nix b/pkgs/test/overriding.nix index 9d2d0612d23ab..e207e8280545f 100644 --- a/pkgs/test/overriding.nix +++ b/pkgs/test/overriding.nix @@ -68,6 +68,16 @@ let }).pname; expected = "hello-no-final-attrs-overridden"; }; + structuredAttrs-allowedRequisites-nullability = { + expr = + lib.hasPrefix builtins.storeDir + (pkgs.stdenv.mkDerivation { + __structuredAttrs = true; + inherit (pkgs.hello) pname version src; + allowedRequisites = null; + }).drvPath; + expected = true; + }; }; test-extendMkDerivation =