Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add docs for supporting multiple user install on windows #1072

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

dfordivam
Copy link
Collaborator

I tried these instructions by creating multiple user accounts.
It seems that settings the PATH is sufficient for the standard C:\ghcup installations.

For non-standard installation GHCUP_INSTALL_BASE_PREFIX is necessary, to ensure that the ghcup exe does not create / write to C:\ghcup

I am not sure how the GHCUP_MSYS2 + cabal related instructions are to be tested.

Fixes #1070

@hasufell
Copy link
Member

hasufell commented Sep 24, 2024

On windows, we are multi user by default.

They need to adjust the path globally and not per user.

We do the PATH adjustment here:

Add-EnvPath -Path ('{0}\bin' -f ([System.IO.Path]::GetFullPath("$GhcupDir"))) -Container 'User'

So a global install could be supported by the powershell script trivially.

@dfordivam
Copy link
Collaborator Author

Ok, but this didn't work smoothly if the ghcup is not installed at 'C:/'.

It is possible to set the env var globally during install
[Environment]::SetEnvironmentVariable("GHCUP_INSTALL_BASE_PREFIX", 'C:\somedir', [System.EnvironmentVariableTarget]::Machine)

But if the GHCUP_INSTALL_BASE_PREFIX is not defined as user's env variable, then ghcup continues to work with C:\ prefix.

@hasufell
Copy link
Member

But if the GHCUP_INSTALL_BASE_PREFIX is not defined as user's env variable, then ghcup continues to work with C:\ prefix.

That would appear to be a bug, no?

@dfordivam
Copy link
Collaborator Author

Yeah, likely an issue with lookupEnv. I looked around but couldn't find any more info about this issue. Or perhaps lookupEnv is fine, and this should be some other windows specific API?

@hasufell
Copy link
Member

https://learn.microsoft.com/en-us/windows/win32/api/processenv/nf-processenv-getenvironmentvariablew

This function can retrieve either a system environment variable or a user environment variable.

@dfordivam
Copy link
Collaborator Author

Ok, after more debugging figured out the issue, the powershell needs to be restarted for all users after the install to load the new vars from global.

@dfordivam
Copy link
Collaborator Author

I am doing a rewrite of this to be clearer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[DOC] Install globally
2 participants