From 8921a8f53b1f48354403c7c8174cbf4f6f0fb91d Mon Sep 17 00:00:00 2001 From: Shea Levy Date: Tue, 13 Jan 2015 08:39:54 -0500 Subject: Revert "Revert "mkOverridable: Use functors to allow overridable functions"" Original commit was reverted due to using features from a newer nix than hydra had, hydra has since been updated This reverts commit 07e726c85c8f36d3a27fb7254f09ac69c7b94c65. --- default.nix | 4 ++-- lib/customisation.nix | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/default.nix b/default.nix index e0df520721cf..84bb1af84e97 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 04a5cb420335..f16043cf9a3e 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 ( -- cgit 1.4.1