From cb1edb818340d88e7bd33f061dfa59e058199e89 Mon Sep 17 00:00:00 2001 From: Eman Resu <78693624+quatquatt@users.noreply.github.com> Date: Mon, 27 Apr 2026 11:32:52 -0400 Subject: [PATCH] lib.makeOverridable: inline helper function into its usages Also perform some manual beta reductions. --- lib/customisation.nix | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/customisation.nix b/lib/customisation.nix index f20298cb8808..95f1d5ebf69e 100644 --- a/lib/customisation.nix +++ b/lib/customisation.nix @@ -192,14 +192,12 @@ rec { */ newArgs: makeOverridable f (origArgs // (if isFunction newArgs then newArgs origArgs else newArgs)) ); - # Change the result of the function call by applying g to it - overrideResult = g: makeOverridable (mirrorArgs (args: g (f args))) origArgs; in if isAttrs result then result // { override = overrideArgs; - overrideDerivation = fdrv: overrideResult (x: overrideDerivation x fdrv); + overrideDerivation = fdrv: makeOverridable (mirrorArgs (args: overrideDerivation (f args) fdrv)) origArgs; ${if result ? overrideAttrs then "overrideAttrs" else null} = /** Override the attributes that were passed to `mkDerivation` in order to generate this derivation. @@ -211,7 +209,7 @@ rec { */ # NOTE: part of the above documentation had to be duplicated in `mkDerivation`'s `overrideAttrs`. # design/tech debt issue: https://github.com/NixOS/nixpkgs/issues/273815 - fdrv: overrideResult (x: x.overrideAttrs fdrv); + fdrv: makeOverridable (mirrorArgs (args: (f args).overrideAttrs fdrv)) origArgs; } else if isFunction result then # Transform the result into a functor while propagating its arguments