top-level: Make overridePackages extend rather than replace existing overrides

This commit is contained in:
John Ericson 2016-10-12 15:14:49 -04:00
parent da36847d92
commit e4cd45a30c
4 changed files with 77 additions and 64 deletions

View file

@ -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.