-
Notifications
You must be signed in to change notification settings - Fork 842
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
Allow configuring programs directory #2766
Conversation
Thanks for working on this! The problem with this approach is that it means people will need to re-install their GHC versions, and will also leave the old GHC versions still there. This is why we'd prefer to make this an explicit option. The reason to allow it to be specified in the config subset of |
I see. In that case, I think the proper thing to do (from a user perspective) would be to automatically move the data to the new location. But that would mean adding even more special cases for a while. Making this a configurable option with different defaults on Windows than on other platforms looks like an easier solution from an implementation point of view. What do you think? |
Sounds good to me! |
Just use $STACK_ROOT/programs, like on other platforms. This enables the directory to be configurable by setting $STACK_ROOT, and it removes the hard-coded path. When downloading GHC, the archive is downloaded to this directory as well before extraction. (This was the case anyway.) This is perhaps less idiomatic, but $STACK_ROOT exists on Windows regardless, so it seems better to keep everything in one place. Fixes commercialhaskell#1644.
As far as I can git grep, Stack does not use TMP or TEMP or TEMPDIR any more. As of commercialhaskell#996, stack setup does not download to the system temp directory any more.
This is still a slightly different from the old behavior: the default location in STACK_ROOT is used when the environment variable cannot be read (which should never be the case anyway). The only difference is that in that case the "programs" directory inside STACK_ROOT is not capitalized.
This option overrides the localProgramsBase path. Ideally the base path would be removed entirely, but it is also used for Docker- related things.
I rebased this and changed it to keep the I have not tested this on Windows yet, I’ll try that tomorrow. I did test this on Linux. |
LGTM, thanks! |
This pretty much seems to work on windows! |
This removes the hard-coded
$LOCALAPPDATA\Programs\stack
directory, and uses$STACK_ROOT\programs
instead, unifying this path for all programs. This resolves #1644 and also my comment on #996.@borsboom: You noted in #1644 that it would be good to make this configurable in
stack.yaml
. That would certainly be possible, but currently I do not see how that would be useful. I think it would introduce more knobs than necessary. Is there a compelling use case for downloading and extracting GHC to a different location than the snapshots?