summaryrefslogtreecommitdiffstats
path: root/lib/trivial.nix
diff options
context:
space:
mode:
authorJohn Ericson <jericson@galois.com>2016-10-12 15:14:49 -0400
committerJohn Ericson <jericson@galois.com>2016-10-13 11:14:11 -0400
commite4cd45a30c92a19a240df835cdaf6da5f76ea9fc (patch)
treefc234aeb6b3b5714be3c6db9e1c0607496d258d1 /lib/trivial.nix
parentda36847d925058fd86f027b64cc712c57be11ad8 (diff)
top-level: Make `overridePackages` extend rather than replace existing overrides
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.