commercialhaskell / commercialhaskell/stack
Stack not finding correct GHC via nixpkgs
- Dominant language
- Haskell
- Stars
- 4.1k
- Forks
- 850
- Avg merge
- 10h 37m
- Merged PRs (30d)
- 4
Description
Hello - you may already be aware of this, but there's two ways in which the stack/nix infrastructure can go wrong:
1. The nix expression generated in `src/Stack/Nix.hs` uses `with (import {})` - this then relies on the state on the user's machine. This `` will be the nixpkgs in the `$NIX_PATH`, which might be quite out of date since many people have moved over wholesale to flakes these days.
2. The `nixCompilerVersion` function in `src/Stack/Config.Nix.hs` will (not unreasonably) look for a ghc version in `nixpkgs` that has the name format `haskell.compiler.ghc`, like `haskell.compiler.ghc964`. This should work except that the ghc versions in nixpkgs don't always seem to adhere to this format, eg `haskell.compiler.ghc96` is ghc 9.6.4, and `haskell.compiler.ghc964` doesn't exist.
I'm not sure what the best solution to this is, it might be worth storing a map from resolver -> (nixpkgs commit, nixpkgs ghc package name) in the source code, and then falling back to using the existing approach if a resolver is requested that isn't in the map.
Contributor guide
Assessment
This issue has not been assessed yet.