Install Haskell development environment fo all users in Windows

I need a Haskell development environment comprising:

  • GHC
  • cabal-install
  • haskell-language-server
  • an editor (visual studio code)

installed for all users of Windows machines (in a programming laboratory).

Is GHCup able to install the tools for all users of the computer? How can that be achieved?

I’ve never used GHC on windows, but if you fail you can always create an environment on linux server and expose it via vscode-server.

I’m in a similar situation, we need basic Haskell tools (ghc, haskell-language-server, VSCode extension) installed on our electronic exam room’s Windows computers. Because of this the installation needs to be system winde for all users.
@romildo Did you manage to get GHCup installation working for all users on Windows? (And in our case, a remote vscode-server is not an option, our exam machines have only very limited network connectivity.)

You can try an isolated install: User Guide - GHCup

No, I didn’t managed.

Oh, that’s too bad… :slightly_frowning_face:
In our case the student’s user account is copied to the pc on the fly when to student logs in, so copying gigabytes of Haskell installation at that time is out of the question. And we need a way to add the necessary configuration to all students, ideally this would be only the paths and VSCode configs.
Did you manage to solve the problem in some other way?
(Oh, and thanks for answering so quickly!)

As @jaror suggested above, an isolated install should do the trick, e.g.:

ghcup install ghc 8.10.5 --isolate C:\GHC

Then in the users’ profile, add C:\GHC\bin to the PATH.

Sorry, I didn’t notice @jaror 's suggestion (for some reason I didn’t get a notification about it). Thanks, I’ll try that!

On windows, GHCup does not install into the users directory. It installs into e.g. C:\ghcup.

So all you have to do is set the right global environment variables (and possibly file permissions).

  • GHCUP_MSYS2 (to e.g. C:\ghcup\msys64)
  • GHCUP_INSTALL_BASE_PREFIX (to e.g. C:\)
  • PATH to include C:\ghcup\bin

Then the only caveat is: cabal directory. Make sure CABAL_DIR env var is not set. Now… if your users need msys2 C libraries, they have to each adjust their cabal.config accordingly. Also make sure you enable long path behavior.

Also check:

3 Likes

Thanks, I was able to install GHC and HLS using @tristanC 's --isolate option at least on my own Windows 10 virtual machine, and just setting the PATH on a new user was enough for the VSCode extension to work. In our exam, we don’t need cabal, so that’s not a problem.
It seems that ghci (or at least VSCode extension’s “-- >>>” evaluation) works even without the MSys2 variable.
But thanks all for your help, now my next challenge will be to explain this to our IT admins, who have no experience on Haskell, and who are going to ask all kinds of security related questions…

1 Like

The isolate installation has the downside that it’s not managed by GHCup, so it doesn’t know how to uninstall it, for example (this is for safety reasons… we don’t touch directories we don’t own).

Wrt security, check Audit GHCup download practices, e.g. through the Haskell Security Response team · Issue #858 · haskell/ghcup-hs · GitHub

1 Like