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

GHC installation hooks #5580

Closed
hasufell opened this issue Jul 6, 2021 · 2 comments
Closed

GHC installation hooks #5580

hasufell opened this issue Jul 6, 2021 · 2 comments

Comments

@hasufell
Copy link
Contributor

hasufell commented Jul 6, 2021

Motivation

A user may want to delegate the installation of GHC to a 3rd party tool or use a custom shell script to have full control over how and where GHC is installed.

Specification

When stack requests a GHC version, it could:

  1. check for the file $STACK_ROOT/hooks/ghc-install.sh
  2. if the file is executable, invoke it with a set of environment variables set, e.g. GHC version (or commit/repo for the experimental building from source feature @hsyl20 )
  3. read the stdout and treat it as the path to the GHC bin/ directory, so it knows where all the tools are

Rationale

  1. Would allow ghcup to better integrate with stack, by providing a default hook
  2. No maintenance overhead for the stack team, no need to actively integrate with installer tools
  3. Great flexibility for users, they could even use nix or their package manager to install GHC
  4. Requires no PATH shenanigans
  5. This is a very common pattern, used by git, package managers and other tools. It has proven very powerful and light-weight.

Open questions

  1. Would this work on windows the same way?
  2. Should hooks be global or also per-repository?
  3. What exact variables need to be exposed?

References


I currently don't have the capacity to provide a reference implementation, but I'd guess the stack codebase is well structured that this wouldn't be a huge task.

@bgamari @emilypi

@cdornan
Copy link

cdornan commented Jul 7, 2021

@hasufell as you know there is an ongoing discussion of a proposal to solve this problem in a forum dedicated to the issue, which as we all know is highly delicate. Raising this issue here is really not going to help this process. I am closing it.

@cdornan cdornan closed this as completed Jul 7, 2021
@hasufell
Copy link
Contributor Author

hasufell commented Jul 7, 2021

@cdornan I am speechless.

@commercialhaskell commercialhaskell locked and limited conversation to collaborators Jul 7, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants