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:
+20
-10
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user