summary refs log tree commit diff
path: root/lib/trivial.nix
diff options
context:
space:
mode:
Diffstat (limited to 'lib/trivial.nix')
-rw-r--r--lib/trivial.nix8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/trivial.nix b/lib/trivial.nix
index dac8b8d0106..39cbd67fba3 100644
--- a/lib/trivial.nix
+++ b/lib/trivial.nix
@@ -69,9 +69,13 @@ rec {
   #
   #     nix-repl> obj
   #     { __unfix__ = «lambda»; bar = "bar"; extend = «lambda»; foo = "foo + "; foobar = "foo + bar"; }
-  makeExtensible = rattrs:
+  makeExtensible = makeExtensibleWithCustomName "extend";
+
+  # Same as `makeExtensible` but the name of the extending attribute is
+  # customized.
+  makeExtensibleWithCustomName = extenderName: rattrs:
     fix' rattrs // {
-      extend = f: makeExtensible (extends f rattrs);
+      ${extenderName} = f: makeExtensibleWithCustomName extenderName (extends f rattrs);
    };
 
   # Flip the order of the arguments of a binary function.