Skip to content

Commit

Permalink
mkOverridable: Use functors to allow overridable functions
Browse files Browse the repository at this point in the history
  • Loading branch information
shlevy committed Jan 9, 2015
1 parent 96ae5d5 commit 4ee556c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 2 additions & 2 deletions default.nix
Original file line number Diff line number Diff line change
@@ -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

Expand Down
7 changes: 7 additions & 0 deletions lib/customisation.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down

0 comments on commit 4ee556c

Please sign in to comment.