From 18864f27383f058f3fe9dbe1dc9052b128fa5ef0 Mon Sep 17 00:00:00 2001 From: valentin gagarin Date: Wed, 13 Nov 2024 15:24:41 +0100 Subject: [PATCH] make template overrides chainable --- website/lib.nix | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/website/lib.nix b/website/lib.nix index aa8cdaa7..47961906 100644 --- a/website/lib.nix +++ b/website/lib.nix @@ -1,7 +1,20 @@ { lib }: rec { template = g: f: x: - (g (f x)) // { override = o: g (lib.recursiveUpdate (f x) o); }; + let + base = f x; + result = g base; + in + result // { + override = new: + let + base' = lib.recursiveUpdate base new; + result' = g base'; + in + result' // { + override = new: (template g (x': base') x).override new; + }; + }; /** Recursively replace occurrences of `from` with `to` within `string`