summary refs log tree commit diff
diff options
context:
space:
mode:
authorShea Levy <shea@shealevy.com>2015-01-09 13:24:58 -0500
committerShea Levy <shea@shealevy.com>2015-01-09 13:26:34 -0500
commit4ee556cfe9528a321f4a3746ca83f97feacf500e (patch)
tree637aab719d0146ab53b674586a2e9e1f7692a1e4
parent96ae5d58bfa3bb64449bef3703238a1cdc76eff0 (diff)
downloadnixpkgs-4ee556cfe9528a321f4a3746ca83f97feacf500e.tar
nixpkgs-4ee556cfe9528a321f4a3746ca83f97feacf500e.tar.gz
nixpkgs-4ee556cfe9528a321f4a3746ca83f97feacf500e.tar.bz2
nixpkgs-4ee556cfe9528a321f4a3746ca83f97feacf500e.tar.lz
nixpkgs-4ee556cfe9528a321f4a3746ca83f97feacf500e.tar.xz
nixpkgs-4ee556cfe9528a321f4a3746ca83f97feacf500e.tar.zst
nixpkgs-4ee556cfe9528a321f4a3746ca83f97feacf500e.zip
mkOverridable: Use functors to allow overridable functions
-rw-r--r--default.nix4
-rw-r--r--lib/customisation.nix7
2 files changed, 9 insertions, 2 deletions
diff --git a/default.nix b/default.nix
index e0df520721c..84bb1af84e9 100644
--- a/default.nix
+++ b/default.nix
@@ -1,6 +1,6 @@
-if ! builtins ? nixVersion || builtins.compareVersions "1.7" builtins.nixVersion == 1 then
+if ! builtins ? nixVersion || builtins.compareVersions "1.8" builtins.nixVersion == 1 then
 
-  abort "This version of Nixpkgs requires Nix >= 1.7, please upgrade!"
+  abort "This version of Nixpkgs requires Nix >= 1.8, please upgrade!"
 
 else
 
diff --git a/lib/customisation.nix b/lib/customisation.nix
index 04a5cb42033..f16043cf9a3 100644
--- a/lib/customisation.nix
+++ b/lib/customisation.nix
@@ -65,6 +65,13 @@ rec {
           overrideDerivation = fdrv:
             makeOverridable (args: overrideDerivation (f args) fdrv) origArgs;
         })
+      else if builtins.isFunction ff then
+        { override = newArgs:
+            makeOverridable f (origArgs // (if builtins.isFunction newArgs then newArgs origArgs else newArgs));
+          __functor = self: ff;
+          deepOverride = throw "deepOverride not yet supported for functors";
+          overrideDerivation = throw "overrideDerivation not yet supported for functors";
+        }
       else ff;
 
   deepOverrider = newArgs: name: x: if builtins.isAttrs x then (