Skip to content

Commit

Permalink
Respect defaults in shellFor (fixes #2306) (#2322)
Browse files Browse the repository at this point in the history
* Respect defaults in `shellFor` (fixes #2306)

`shellFor` has an argument `allToolDeps` that when set to `true` tells haskell.nix to include all the tool dependencies of all the packages in the shell.  This does not work well for `stackProject` projects (since stackage includes a lot of packages).  So it is disabled by default in `modules/stack-project.nix`.

This default is currently ignored if `shellFor` is called directly.

This change ensures that `shellFor` respects the defaults and any shell arguments passed to the project. As a result, `project.shell` and `project.shellFor {}` will now behave consistently.

* Fix use of `hackage` in `mkStackPkgSet`
  • Loading branch information
hamishmack authored Feb 18, 2025
1 parent 2df64d5 commit 8bed466
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions overlays/haskell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ final: prev: {
You may need to update haskell.nix to one that includes a newer stackage.nix.
'');
# The compiler referenced in the stack config
compiler = (stack-pkgs.extras hackage).compiler or (pkg-def hackage).compiler;
compiler = (stack-pkgs.extras hackageForStack).compiler or (pkg-def hackageForStack).compiler;
patchesModule = ghcHackagePatches.${compiler.nix-name} or {};
# Remove fake packages generated from stack keywords used in ghc-options
removeStackSpecial = module: if builtins.typeOf module == "set"
Expand Down Expand Up @@ -823,7 +823,7 @@ final: prev: {
shellFor = shellArgs:
let
# These are the args we will pass to the main shell.
args' = builtins.removeAttrs shellArgs [ "crossPlatforms" ];
args' = builtins.removeAttrs (rawProject.args.shell // shellArgs) [ "crossPlatforms" ];
# These are the args we will pass to the shells for the corss compiler
argsCross =
# These things should match main shell
Expand All @@ -847,7 +847,7 @@ final: prev: {
});

# Default shell
shell = shellFor rawProject.args.shell;
shell = shellFor {};

# Like `.hsPkgs.${packageName}` but when compined with `getComponent` any
# cabal configure errors are defered until the components derivation builds.
Expand Down

0 comments on commit 8bed466

Please sign in to comment.