Browse Source

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 07e726c85c.
nsd-state-dir
Shea Levy 8 years ago
parent
commit
8921a8f53b
  1. 4
      default.nix
  2. 7
      lib/customisation.nix

4
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

7
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 (

Loading…
Cancel
Save