diff --git a/dynamic.nix b/dynamic.nix index 5d2728c..a8b00f2 100644 --- a/dynamic.nix +++ b/dynamic.nix @@ -135,7 +135,24 @@ pkgs.mkShell { ) ++ attrValues haskell-tools ++ optionals withGHCTooling ( - with pkgs; [ python3 automake autoconf alex happy git libffi.dev ] + # `pkgs.alex` and `pkgs.happy` from nixpkgs are built with a different + # GHC than the shell's `compiler` (currently ghc-9.10.3 in nixpkgs + # haskellPackages), and their library outputs anchor that foreign GHC + # in the closure (~2.15 GB on Darwin). Use haskell.nix's `tool` builder + # — same pattern as cross-js.nix and cross-windows.nix — to build them + # with the shell's `compiler-nix-name`, so library outputs reference + # the GHC that's already in the closure rather than dragging in a + # second one. `gitMinimal` swaps out heavyweight git (saves ~150 MB + # of perl-modules + git-doc that aren't used inside the shell). + with pkgs; [ + python3 + automake + autoconf + (tool "alex") + (tool "happy") + gitMinimal + libffi.dev + ] ) ; diff --git a/tool-map.nix b/tool-map.nix index 1a3a152..14fe6c7 100644 --- a/tool-map.nix +++ b/tool-map.nix @@ -43,8 +43,11 @@ compiler-nix-name: tool: { cabalProject = __readFile (src + "/cabal.project"); configureArgs = "--disable-benchmarks --disable-tests"; }; - happy = { version = "1.20.1.1"; inherit cabalProjectLocal; }; - alex = { version = "3.2.7.3"; inherit cabalProjectLocal; }; + # happy/alex don't need head.hackage (they're standard mainline packages and + # build cleanly from regular hackage). Dropping `inherit cabalProjectLocal` + # also avoids depending on the head.hackage SHA pin going stale. + happy = { version = "2.1.7"; }; + alex = { version = "3.5.4.0"; }; cabal = rec { src = self.inputs.cabal; # We use the cabal.boostrap.project file, as we don't