Skip to content

Stack not finding correct GHC via nixpkgs #6536

Open
@harris-chris

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 <nixpkgs> {}) - this then relies on the state on the user's machine. This <nixpkgs> 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<major><minor><patch>, 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.

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions