haskell-modules: implement overrideScope method for deep overriding

deepOverride turns out to be completely unfeasible for non-trivial overrides.
Nix evaluates for an eternity, and then comes back saying:

  Too many heap sections: Increase MAXHINCR or MAX_HEAP_SECTS
  nix-instantiate killed by signal 6

The hand-written deep-override, on the other hand, performs the job in a
fraction of a second, no problem.

All bow to Russell O'Connor!
This commit is contained in:
Peter Simons 2015-01-08 18:29:37 +01:00
parent d737d463c6
commit 3c8b33eee4

View file

@ -31,8 +31,12 @@ let
mkDerivation = drv: args.mkDerivation (drv // f drv);
});
callPackageWithScope = scope: drv: args: (stdenv.lib.callPackageWith scope drv args) // {
overrideScope = f: callPackageWithScope (fix (extend scope.__unfix__ f)) drv args;
};
defaultScope = pkgs // pkgs.xlibs // pkgs.gnome // self;
callPackage = drv: args: stdenv.lib.callPackageWith defaultScope drv args;
callPackage = drv: args: callPackageWithScope defaultScope drv args;
in
import ./hackage-packages.nix { inherit pkgs stdenv callPackage; } self // {