Skip to content

Commit

Permalink
Try #1794:
Browse files Browse the repository at this point in the history
  • Loading branch information
iohk-bors[bot] committed Nov 30, 2022
2 parents 5b03fc0 + 07c42a7 commit ee7f5f4
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
8 changes: 6 additions & 2 deletions builder/shell-for.nix
Expand Up @@ -15,6 +15,7 @@
, withHoogle ? true
, withHaddock ? withHoogle
, exactDeps ? false
, allToolDeps ? !exactDeps
, tools ? {}
, packageSetupDeps ? true
, enableDWARF ? false
Expand Down Expand Up @@ -109,8 +110,11 @@ let
nativeBuildInputs = removeSelectedInputs
(uniqueWithName (lib.concatMap (c: c.executableToolDepends)
# When not using `exactDeps` cabal may try to build arbitrary dependencies
# so in this case we need to provide the build tools for all of hsPkgs:
(if exactDeps then selectedComponents else allHsPkgsComponents)));
# so in this case we need to provide the build tools for all of `hsPkgs`.
# In some cases those tools may be unwanted or broken so the `allToolDeps`
# flag can be set to `false` to disable this (stack projects default `allToolDeps`
# to `false` as `hsPkgs` for them includes all of stackage):
(if exactDeps || !allToolDeps then selectedComponents else allHsPkgsComponents)));

# Set up a "dummy" component to use with ghcForComponent.
component = {
Expand Down
10 changes: 10 additions & 0 deletions modules/shell.nix
Expand Up @@ -29,6 +29,16 @@
type = lib.types.bool;
default = false;
};
allToolDeps = lib.mkOption {
type = lib.types.bool;
default = !config.exactDeps;
description = ''
Indicates if the shell should include all the tool dependencies
of in the haskell packages in the project. Defaulted to `false` in
stack projects (to avoid trying to build the tools used by
every `stackage` package).
'';
};
tools = lib.mkOption {
type = lib.types.attrsOf lib.types.unspecified;
default = {};
Expand Down
5 changes: 5 additions & 0 deletions modules/stack-project.nix
Expand Up @@ -91,4 +91,9 @@ with types;
description = "Deprecated in favour of `compiler-nix-name`";
};
};
config = {
# For stack projects we normally do not want to include the tool dependencies
# of all the hsPkgs (all of stackage).
shell.allToolDeps = mkDefault false;
};
}

0 comments on commit ee7f5f4

Please sign in to comment.