Based on https://gist.github.com/lsmor/bb632565cd96be9da589b6e91f80f9ba:
- Disallow stack from downloading its own ghc by adding
system-ghc: trueto thestack.yaml - Explicitly select the stackage snapshot that corresponds with the desired ghc version (in this case, per https://www.stackage.org, LTS 22.43 matches ghc-9.6.6).
The resulting stack.yaml:
snapshot:
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/22/43.yaml
packages: []
system-ghc: true
Just in case, I also deleted ~/.stack.
Then ran stack update to update the lockfile.