input-output-hk / haskell.nix

Alternative Haskell Infrastructure for Nixpkgs
https://input-output-hk.github.io/haskell.nix
Apache License 2.0
559 stars 239 forks source link

Can't use `nix develop` with ghc921 #1292

Closed ghost closed 3 years ago

ghost commented 3 years ago

Steps to reproduce:

#!/usr/bin/env bash
mkdir htest && cd htest
cabal init
touch flake.nix # (& paste demo flake from tutorials/getting-started-flakes)

# remove base version from cabal file
sed -i 's/base .*$/base/' ./htest.cabal 

# rename hello
sed -i 's/hello/htest/g' ./flake.nix 

# comment `crossPlatforms = p: [p.ghcjs];`
sed -i 's/ crossPlatforms/ # crossPlatforms/' ./flake.nix 

# comment `shell.crossPlatform = p: [p.ghcjs];`
sed -i 's/shell.crossPlatform/# shell.crossPlatform/' ./flake.nix 

# comment `hlint` from `shell.tools`
sed -i 's/hlint/# hlint/' ./flake.nix 

# comment haskell-language-server from `shell.tools`
sed -i 's/haskell-language-server/# haskell-language-server/' ./flake.nix 

sed -i 's/ghc8104/ghc921/' ./flake.nix

grep -r "hoogle" # 0 occurrences

nix develop

Error:

error: builder for '/nix/store/ccswd8vy12ab5lhzrfbyc00gf7bvhydg-cabal-configure-error.drv' failed with exit code 1;
       last 10 log lines:
       > installed instance)
       > [_11] fail (backjumping, conflict set: basement, cryptonite, integer-gmp,
       > cryptonite:integer-gmp)
       > After searching the rest of the dependency tree exhaustively, these were the
       > goals I've had most trouble fulfilling: integer-gmp, tls, cryptonite, base,
       > cryptonite:integer-gmp, warp-tls, basement, certificate, x509, memory, async,
       > memory:support_foundation, hoogle, tls-session-manager
       > Try running with --minimize-conflict-set to improve the error message.
       >
       > Unable to find component hoogle:exe:hoogle due to the above cabal configuration error
       For full logs, run 'nix log /nix/store/ccswd8vy12ab5lhzrfbyc00gf7bvhydg-cabal-configure-error.drv'.
error: 1 dependencies of derivation '/nix/store/rc89vgbbl0m3xdh83xjgy0zsvxhwahsy-hoogle-local-0.1.drv' failed to build
error: 1 dependencies of derivation '/nix/store/cqn4v2rq3dxlnrgwbwwbvlhlwksdkgjv-ghc-shell-for-htest-ghc-9.2.1-env.drv' failed to build
error: 1 dependencies of derivation '/nix/store/l0csk2cfi9pychb19792pmmrflj5jskl-ghc-shell-for-htest-env.drv' failed to build

It works just by replacing ghc921 with ghc8107

cumber commented 3 years ago

This isn't directly a problem with haskell.nix, it's just that some of the ecosystem needed to build tools like haskell-language-server, hoogle, etc hasn't yet been updated to support GHC 9.2.1. This particular error is because basement is a (deep) dependency of hoogle, and doesn't build on GHC 9.2.1.

If you want to use 9.2.1 you'll have to (for now) avoid using some of those tools. There's also a withHoogle flag for shells that defaults to true (so you need to explicitly add withHoogle = false), but my flake's structure doesn't match the tutorial's one, so I'm not sure where to put it.

ghost commented 3 years ago

I didn't knew withHoogle defaults to true. I don't think this is documented and I posted the whole step-by-step script showing 0 occurences of "hoogle" to emphasize I wasn't using it :P.

Of course, it works now. Thanks.