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.)
Oh, that’s too bad…
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!)
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.configaccordingly. Also make sure you enable long path behavior.
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…
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).