Merge pull request #40710 from ElvishJerricco/overrideCabal-getHaskellBuildInputs

Make getHaskellBuildInputs / shellFor work with overrideCabal (Fixes #40266)
This commit is contained in:
Peter Simons 2018-05-22 10:37:26 +02:00 committed by GitHub
commit 07a045922d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 4 deletions

View File

@ -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.

View File

@ -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;
@ -238,7 +238,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)