Skip to content

Hermetic GHC bindist on Unix #1393

Open
@aherrmann

Description

@aherrmann

Is your feature request related to a problem? Please describe.
The GHC bindist on Unix requires a ./configure && make && make install step before the toolchain can be used. Currently, haskell_register_ghc_bindists executes this installation in a repository rule. This means that this step is not sandboxed and cannot be cached by Bazel (the repository cache is limited to downloads). Additionally, repository rules don't have access to Bazel's toolchain resolution, so we cannot point GHC to the correct CC toolchain during ./configure and instead it will find whichever toolchain is available in the environment.

Describe the solution you'd like
I would like for the ./configure && make && make install step to happen in a regular sandboxed build action. This would make this installation step cacheable and allow us to control which CC toolchain GHC discovers at this step.

Describe alternatives you've considered
Users can avoid these issues today by using a nixpkgs provided GHC instead.

Another approach would be to pull in a system installed GHC from outside Bazel as described in #1320. I think it would be good if rules_haskell supported both a hermetic haskell_register_ghc_bindists as well as haskell_register_ghc_host.

Additional context
One difficulty is that we will need to predict which files this installation step produces exactly, due to the lack of dynamic dependencies in Bazel. This will depend on the platform and GHC version.

One approach would be to let the installation step run in a mode where it produces only metadata: the list of files, package dependencies, etc. (essentially what pkgdb_to_bzl.py determines). This metadata could then be checked in (similar to a lock file) and be used to predict the outputs of the installation step going forward. We could ship the lock files for the Linux and MacOS GHC bindists that are supported by rules_haskell as part of rules_haskell. This way this approach would not change the current API.

Note, the GHC bindist on Windows does not require any ./configure or make steps and is useable immediately after unpacking.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions