From 1219a105928a50713d0d3ba156ac045d19f71f63 Mon Sep 17 00:00:00 2001 From: DavHau Date: Tue, 26 Oct 2021 20:53:29 +0700 Subject: [PATCH] overrides: allow passing functions for attributes --- src/utils/override.nix | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/utils/override.nix b/src/utils/override.nix index 41d01299..47c8b85d 100644 --- a/src/utils/override.nix +++ b/src/utils/override.nix @@ -52,7 +52,19 @@ let (lib.filterAttrs (n: v: lib.hasPrefix "override" n) condOverride); in b.foldl' - (pkg: overrideFunc: pkg."${overrideFunc.funcName}" overrideFunc.func) + (pkg: overrideFunc: + pkg."${overrideFunc.funcName}" + (old: + let + updateAttrsFuncs = overrideFunc.func old; + in + lib.mapAttrs + (attrName: maybeFunction: + if b.isFunction maybeFunction then + maybeFunction old."${attrName}" + else + maybeFunction) + updateAttrsFuncs)) pkg overrideFuncs; in