From e4cd45a30c92a19a240df835cdaf6da5f76ea9fc Mon Sep 17 00:00:00 2001 From: John Ericson Date: Wed, 12 Oct 2016 15:14:49 -0400 Subject: top-level: Make `overridePackages` extend rather than replace existing overrides --- lib/trivial.nix | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'lib/trivial.nix') diff --git a/lib/trivial.nix b/lib/trivial.nix index a0c31757ba7..acf1ccab879 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. -- cgit 1.4.1