diff --git a/pkgs/development/haskell-modules/default.nix b/pkgs/development/haskell-modules/default.nix index d2ecc3381287..15a4ed42e8c0 100644 --- a/pkgs/development/haskell-modules/default.nix +++ b/pkgs/development/haskell-modules/default.nix @@ -6,12 +6,13 @@ let - inherit (stdenv.lib) fix' extends; + inherit (stdenv.lib) fix' extends makeOverridable; + inherit (import ./lib.nix { inherit pkgs; }) overrideCabal; haskellPackages = self: let - mkDerivation = pkgs.callPackage ./generic-builder.nix { + mkDerivationImpl = pkgs.callPackage ./generic-builder.nix { inherit stdenv; inherit (pkgs) fetchurl pkgconfig glibcLocales coreutils gnugrep gnused; jailbreak-cabal = if (self.ghc.cross or null) != null @@ -37,9 +38,7 @@ let }); }; - overrideCabal = drv: f: drv.override (args: args // { - mkDerivation = drv: args.mkDerivation (drv // f drv); - }); + mkDerivation = makeOverridable mkDerivationImpl; callPackageWithScope = scope: drv: args: (stdenv.lib.callPackageWith scope drv args) // { overrideScope = f: callPackageWithScope (mkScope (fix' (extends f scope.__unfix__))) drv args; diff --git a/pkgs/development/haskell-modules/lib.nix b/pkgs/development/haskell-modules/lib.nix index cc9daf336b02..ab817b7b2a16 100644 --- a/pkgs/development/haskell-modules/lib.nix +++ b/pkgs/development/haskell-modules/lib.nix @@ -3,7 +3,7 @@ rec { overrideCabal = drv: f: (drv.override (args: args // { - mkDerivation = drv: args.mkDerivation (drv // f drv); + mkDerivation = drv: (args.mkDerivation drv).override f; })) // { overrideScope = scope: overrideCabal (drv.overrideScope scope) f; };