From 20b7f2410bd1ee9bc1f654262da601985f623567 Mon Sep 17 00:00:00 2001 From: Aliaksandr Date: Sun, 5 Apr 2026 02:51:03 +0300 Subject: [PATCH] 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. --- lib/customisation.nix | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/lib/customisation.nix b/lib/customisation.nix index e9e88aff7cb5..5db9275aadc7 100644 --- a/lib/customisation.nix +++ b/lib/customisation.nix @@ -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