lib/customisation: reduce // merges in extendDerivation

Fold the 'all' attribute into the listToAttrs call alongside the outputs, so commonAttrs builds from drv // listToAttrs(...) // passthru // { drvPath; outPath; } instead of four separate merges with a standalone 'all' attrset.

Also convert remaining optionalAttrs to nullable attr names in extendDerivation, overrideDerivation, and makeOverridable.

Per-derivation // merges drop from 4 to 3.
This commit is contained in:
Aliaksandr
2026-05-18 03:54:26 +03:00
parent d6d58a85e1
commit 20b7f2410b
+20 -10
View File
@@ -401,7 +401,25 @@ rec {
condition: passthru: drv:
let
commonAttrs =
drv // (listToAttrs outputsList) // { all = map (x: x.value) outputsList; } // passthru;
drv
// listToAttrs (
outputsList
++ [
{
name = "all";
value = map (x: x.value) outputsList;
}
]
)
// passthru
// {
drvPath =
assert condition;
drv.drvPath;
outPath =
assert condition;
drv.outPath;
};
outputsList = map (outputName: {
name = outputName;
@@ -423,15 +441,7 @@ rec {
};
}) (drv.outputs or [ "out" ]);
in
commonAttrs
// {
drvPath =
assert condition;
drv.drvPath;
outPath =
assert condition;
drv.outPath;
};
commonAttrs;
/**
Strip a derivation of all non-essential attributes, returning