aboutsummaryrefslogtreecommitdiff
path: root/lib/trivial.nix
diff options
context:
space:
mode:
authorCharles Strahan <charles@cstrahan.com>2016-10-26 14:01:13 -0400
committerGitHub <noreply@github.com>2016-10-26 14:01:13 -0400
commitca2b03439f31dca0beee0d9b492dd18db78315cd (patch)
tree0e3a3830d1b797735f786c6ffce9c4e6ebe397e5 /lib/trivial.nix
parent6f1f1d86c1f6a82b44099d744cc52d150321e07e (diff)
parent3ca3b145ead9ce528b6b8cbf4db8e2a73a26bbe7 (diff)
Merge pull request #19496 from Ericson2314/overridePackages
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 dac8b8d0106d..39cbd67fba36 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.