From 5fec0f0f34e6f168ea2404a84b9c5a079a64a8d7 Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Tue, 18 Feb 2025 14:18:32 +1300 Subject: [PATCH 1/2] 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. --- overlays/haskell.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/overlays/haskell.nix b/overlays/haskell.nix index 1d3acd4dea..f074d088f9 100644 --- a/overlays/haskell.nix +++ b/overlays/haskell.nix @@ -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 @@ -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. From 73a8a90dcad7cde1163f3c1402fa967fe8ce90e4 Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Tue, 18 Feb 2025 15:01:33 +1300 Subject: [PATCH 2/2] Fix use of `hackage` in `mkStackPkgSet` --- overlays/haskell.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/overlays/haskell.nix b/overlays/haskell.nix index f074d088f9..5f272b331b 100644 --- a/overlays/haskell.nix +++ b/overlays/haskell.nix @@ -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"