Skip to content

Commit b803d30

Browse files
committed
mkDerivation: make allowedReference/allowedRequisites nullable when __structuedAttrs is true
1 parent 8bc5502 commit b803d30

2 files changed

Lines changed: 17 additions & 2 deletions

File tree

pkgs/stdenv/generic/make-derivation.nix

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ let
1717
elemAt
1818
extendDerivation
1919
filter
20+
filterAttrs
2021
findFirst
2122
getDev
2223
head
@@ -715,8 +716,12 @@ let
715716
];
716717
}
717718
// (
719+
let
720+
attrsOutputChecks = makeOutputChecks attrs;
721+
attrsOutputChecksFiltered = filterAttrs (_: v: v != null) attrsOutputChecks;
722+
in
718723
if !__structuredAttrs then
719-
makeOutputChecks attrs
724+
attrsOutputChecks
720725
else
721726
{
722727
outputChecks = builtins.listToAttrs (
@@ -725,7 +730,7 @@ let
725730
value =
726731
let
727732
raw = zipAttrsWith (_: builtins.concatLists) [
728-
(makeOutputChecks attrs)
733+
attrsOutputChecksFiltered
729734
(makeOutputChecks attrs.outputChecks.${name} or { })
730735
];
731736
in

pkgs/test/overriding.nix

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,16 @@ let
6262
}).pname;
6363
expected = "hello-no-final-attrs-overridden";
6464
};
65+
structuredAttrs-allowedRequisites-nullablility = {
66+
expr =
67+
lib.hasPrefix builtins.storeDir
68+
(pkgs.stdenv.mkDerivation {
69+
__structuredAttrs = true;
70+
inherit (pkgs.hello) pname version src;
71+
allowedRequisites = null;
72+
}).drvPath;
73+
expected = true;
74+
};
6575
};
6676

6777
test-extendMkDerivation =

0 commit comments

Comments
 (0)