Skip to content

Commit d8d0d24

Browse files
Try #1794:
2 parents fadf922 + 07c42a7 commit d8d0d24

File tree

3 files changed

+21
-2
lines changed

3 files changed

+21
-2
lines changed

builder/shell-for.nix

+6-2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
, withHoogle ? true
1616
, withHaddock ? withHoogle
1717
, exactDeps ? false
18+
, allToolDeps ? !exactDeps
1819
, tools ? {}
1920
, packageSetupDeps ? true
2021
, enableDWARF ? false
@@ -109,8 +110,11 @@ let
109110
nativeBuildInputs = removeSelectedInputs
110111
(uniqueWithName (lib.concatMap (c: c.executableToolDepends)
111112
# When not using `exactDeps` cabal may try to build arbitrary dependencies
112-
# so in this case we need to provide the build tools for all of hsPkgs:
113-
(if exactDeps then selectedComponents else allHsPkgsComponents)));
113+
# so in this case we need to provide the build tools for all of `hsPkgs`.
114+
# In some cases those tools may be unwanted or broken so the `allToolDeps`
115+
# flag can be set to `false` to disable this (stack projects default `allToolDeps`
116+
# to `false` as `hsPkgs` for them includes all of stackage):
117+
(if exactDeps || !allToolDeps then selectedComponents else allHsPkgsComponents)));
114118

115119
# Set up a "dummy" component to use with ghcForComponent.
116120
component = {

modules/shell.nix

+10
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,16 @@
2929
type = lib.types.bool;
3030
default = false;
3131
};
32+
allToolDeps = lib.mkOption {
33+
type = lib.types.bool;
34+
default = !config.exactDeps;
35+
description = ''
36+
Indicates if the shell should include all the tool dependencies
37+
of in the haskell packages in the project. Defaulted to `false` in
38+
stack projects (to avoid trying to build the tools used by
39+
every `stackage` package).
40+
'';
41+
};
3242
tools = lib.mkOption {
3343
type = lib.types.attrsOf lib.types.unspecified;
3444
default = {};

modules/stack-project.nix

+5
Original file line numberDiff line numberDiff line change
@@ -91,4 +91,9 @@ with types;
9191
description = "Deprecated in favour of `compiler-nix-name`";
9292
};
9393
};
94+
config = {
95+
# For stack projects we normally do not want to include the tool dependencies
96+
# of all the hsPkgs (all of stackage).
97+
shell.allToolDeps = mkDefault false;
98+
};
9499
}

0 commit comments

Comments
 (0)