summaryrefslogtreecommitdiffstats
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 a0c31757ba7a..acf1ccab8798 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.