Skip to content

Allow Nix-based consumers to avoid the default bindist GHC fetch #2450

Description

@jonathanlking

MODULE.bazel registers a bindist-based GHC toolchain as a (non-dev) dependency:

haskell_toolchains = use_extension(
    "@rules_haskell//extensions:haskell_toolchains.bzl",
    "haskell_toolchains",
)
haskell_toolchains.bindists()

# ...

register_toolchains(
    "@all_bindist_toolchains//:all",
    "@rules_haskell_ghc_windows_amd64_cc_toolchain//:all",
    "@rules_haskell_python_local//:toolchain",
)

While this provides a convenient zero-configuration default, for those provisioning GHC via Nix (using rules_haskell_nix) this causes issues.
The bindist extension eagerly fetches a platform-native GHC binary distribution at repository-fetch time, which expects host system libraries (e.g. libtinfo.so.5) that aren't present on Nix-based systems. This fetch fails even though the consumer never asked for a bindist.

There doesn't appear to be a way for a consumer to opt out of the propagating bindist? Our current workaround is to patch both declarations with dev_dependency = True:

This is consistent with the Nix toolchain register_toolchains, which already has dev_dependency = True, but it does mean that consumers who want the default bindist would need to explicitly request it in their own MODULE.bazel.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions