vzarytovskii / haskell-dev-env

A Dockerfile for Haskell Development, and DevContainer for VSCode, for installing GHC HLS (Haskell Language Server) and the required plugins
MIT License
56 stars 17 forks source link

issue(stack): failed to set stack's --system-ghc resolver #10

Closed fvrrrn closed 10 months ago

fvrrrn commented 10 months ago

Expected Behavior

stack config --system-ghc set resolver default

Should set resolver to default and exit gracefully.

Current Behavior

stack config --system-ghc set resolver default

Usage: stack config set resolver SNAPSHOT

Possible Solution

Supposedly, new recommended stack version (2.11.1 on the moment of writing) does not allow passing --system-ghc flag which wasn't the case when this Dev Container was created, so my guess is to update the command.

Steps to Reproduce

  1. Install Docker for Windows
  2. Install Docker on WSL2
  3. Install VSCode
  4. Run Reopen in Container from command palette

P. S.

I'm totally new to Haskell and its ecosystem, I've just started learning the language and functional programming in general, so cabal, stack, ghcup are all foreign concepts to me currently, that's why it is unclear to me what should one do to fix the error, thanks in advance.

vzarytovskii commented 10 months ago

The "default" value for resolver is explicitly processed in Dockerfile (it's loaded from stack website and parsed out), and not something handled by stack itself.

Regarding the --system-ghc flag, it might've been a copy-paste issue, I will check it.

vzarytovskii commented 10 months ago

@fvrrrn I don't see an issue building container (I didn't open it in the vscode, but rather built it with docker).

It seems to be building fine, setting stack config options as well, as expected:

vscode@1121e2a2dc36:~$ stack --version
Version 2.13.1, Git revision 8102bb8afce90fc954f48efae38b87f37cabc988 aarch64 hpack-0.36.0

vscode@1121e2a2dc36:~$ cat ./.stack/config.yaml | grep -v "#"

templates:
  params:

system-ghc: true
install-ghc: false
ghc-options:
  "$everything": -haddock

I probably can explicitly remove the --system-ghc flag, just in case if it gets deprecated (or already deprecated in some versions).

vzarytovskii commented 10 months ago

Ok, I guess the issue is that stack ls snapshots remote does not return a resolver which is "recommended" for the GHC_VERSION which is currently in the docker file (9.4.4), I'll see if I can work around it.

vzarytovskii commented 10 months ago

This should be fixed in HEAD, I've upgraded a bunch of things as well (Image, GHC itself, packages).