Skip to content

Commit 85df634

Browse files
committed
nix: use current ghc for tools in the shell
Theses tools are pulled in the shell, but we don't need them to match the GHC version used for development. Said otherwise, as long as we use a working `cabal-install` to build with GHC 9.2, we don't care if that cabal-install was built with GHC 8.10. This gives more chance for theses tools to work and be in the binary cache of nixpkgs.
1 parent 772bb33 commit 85df634

File tree

1 file changed

+17
-7
lines changed

1 file changed

+17
-7
lines changed

flake.nix

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -251,22 +251,32 @@
251251
removeAttrs hlsSources ghc921Config.disabledPlugins
252252
else
253253
hlsSources));
254-
buildInputs = [ gmp zlib ncurses capstone tracy (gen-hls-changelogs hpkgs) pythonWithPackages ]
255-
++ (with hpkgs; [
256-
cabal-install
257-
hie-bios
254+
# For theses tools packages, we use ghcDefault
255+
# This removes a rebuild with a different GHC version
256+
# Theses programs are tools, used as binary, independently of the
257+
# version of GHC.
258+
# The drawback of this approach is that our shell may pull two GHC
259+
# version in scope (the `ghcDefault` one, and the one defined in
260+
# `hpkgs`.)
261+
# The advantage is that we won't have to rebuild theses tools (and
262+
# dependencies) with a recent GHC which may not be supported by
263+
# them.
264+
buildInputs = [ gmp zlib ncurses capstone tracy (gen-hls-changelogs ghcDefault) pythonWithPackages ]
265+
++ [
266+
pkgs.cabal-install
267+
ghcDefault.hie-bios
258268
hlint
259269
# ormolu
260270
# stylish-haskell
261-
opentelemetry-extra
262-
]);
271+
ghcDefault.opentelemetry-extra
272+
];
263273

264274
src = null;
265275
shellHook = ''
266276
export LD_LIBRARY_PATH=${gmp}/lib:${zlib}/lib:${ncurses}/lib:${capstone}/lib
267277
export DYLD_LIBRARY_PATH=${gmp}/lib:${zlib}/lib:${ncurses}/lib:${capstone}/lib
268278
export PATH=$PATH:$HOME/.local/bin
269-
${if hpkgs.ghc.version != "9.0.1" then (pre-commit-check hpkgs).shellHook else ""}
279+
${(pre-commit-check ghcDefault).shellHook}
270280
'';
271281
};
272282
# Create a hls executable

0 commit comments

Comments
 (0)