summaryrefslogtreecommitdiffstats
path: root/lib/trivial.nix
diff options
context:
space:
mode:
authorVladimír Čunát <vcunat@gmail.com>2017-04-14 19:11:17 +0200
committerVladimír Čunát <vcunat@gmail.com>2017-04-14 19:11:17 +0200
commit2090aa4f65e860567af03cb3b7aa042df7168ead (patch)
treebdf4623501830af0cbf68f2d22075f70b38157b5 /lib/trivial.nix
parenteec35cb6bd82cb0eba69c55e83990f3b9f0107dc (diff)
parent4aec96b379d3f1b89128297b0943253d6961cf94 (diff)
Merge: fixup a bad merge
For details see: https://github.com/NixOS/nixpkgs/commit/24444513fb5#commitcomment-21767916
Diffstat (limited to 'lib/trivial.nix')
-rw-r--r--lib/trivial.nix9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/trivial.nix b/lib/trivial.nix
index 6cdc869b300b..62906339e605 100644
--- a/lib/trivial.nix
+++ b/lib/trivial.nix
@@ -85,6 +85,15 @@ rec {
# argument, but it's nice this way if several uses of `extends` are cascaded.
extends = f: rattrs: self: let super = rattrs self; in super // f self super;
+ # Compose two extending functions of the type expected by 'extends'
+ # into one where changes made in the first are available in the
+ # 'super' of the second
+ composeExtensions =
+ f: g: self: super:
+ let fApplied = f self super;
+ super' = super // fApplied;
+ in fApplied // g self super';
+
# Create an overridable, recursive attribute set. For example:
#
# nix-repl> obj = makeExtensible (self: { })