From 5523ec8f3c78704c6e76b7675bfce41d24a3feb1 Mon Sep 17 00:00:00 2001 From: Will Fancher Date: Thu, 17 May 2018 20:35:53 -0400 Subject: [PATCH] Make getHaskellBuildInputs / shellFor work with overrideCabal --- pkgs/development/haskell-modules/lib.nix | 7 +++++-- pkgs/development/haskell-modules/make-package-set.nix | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/pkgs/development/haskell-modules/lib.nix b/pkgs/development/haskell-modules/lib.nix index ff86e06979c1..55e45bd6559d 100644 --- a/pkgs/development/haskell-modules/lib.nix +++ b/pkgs/development/haskell-modules/lib.nix @@ -297,8 +297,11 @@ rec { # This is useful to build environments for developing on that # package. getHaskellBuildInputs = p: - (p.override { mkDerivation = extractBuildInputs p.compiler; - }).haskellBuildInputs; + (overrideCabal p (args: { + passthru = (args.passthru or {}) // { + _getHaskellBuildInputs = extractBuildInputs p.compiler args; + }; + }))._getHaskellBuildInputs; # Under normal evaluation, simply return the original package. Under # nix-shell evaluation, return a nix-shell optimized environment. diff --git a/pkgs/development/haskell-modules/make-package-set.nix b/pkgs/development/haskell-modules/make-package-set.nix index bde4f85f6784..1ab37f080b1d 100644 --- a/pkgs/development/haskell-modules/make-package-set.nix +++ b/pkgs/development/haskell-modules/make-package-set.nix @@ -38,7 +38,7 @@ let inherit (stdenv) buildPlatform hostPlatform; inherit (stdenv.lib) fix' extends makeOverridable; - inherit (haskellLib) overrideCabal; + inherit (haskellLib) overrideCabal getHaskellBuildInputs; mkDerivationImpl = pkgs.callPackage ./generic-builder.nix { inherit stdenv; @@ -229,7 +229,7 @@ in package-set { inherit pkgs stdenv callPackage; } self // { shellFor = { packages, withHoogle ? false, ... } @ args: let selected = packages self; - packageInputs = builtins.map (p: p.override { mkDerivation = haskellLib.extractBuildInputs p.compiler; }) selected; + packageInputs = builtins.map getHaskellBuildInputs selected; haskellInputs = builtins.filter (input: pkgs.lib.all (p: input.outPath != p.outPath) selected)