Workspace rules (Nixpkgs)
Bazel

Workspace rules (Nixpkgs)


haskell_register_ghc_nixpkgs

haskell_register_ghc_nixpkgs(version, is_static, build_file, build_file_content, compiler_flags, compiler_flags_select, haddock_flags, repl_ghci_args, locale_archive, attribute_path, sh_posix_attributes, nix_file, nix_file_deps, nixopts, locale, repositories, repository, nix_file_content)

Register a package from Nixpkgs as a toolchain.

Toolchains can be used to compile Haskell code. To have this toolchain selected during toolchain resolution, set a host platform that includes the @rules_haskell//haskell/platforms:nixpkgs constraint value.

Attributes

version

Unknown; Required

is_static

Boolean; Optional; Default is False

build_file

Unknown; Optional

build_file_content

Unknown; Optional

compiler_flags

Unknown; Optional

compiler_flags_select

Unknown; Optional

temporary workaround to pass conditional arguments. See https://github.com/bazelbuild/bazel/issues/9199 for details.

haddock_flags

Unknown; Optional

repl_ghci_args

Unknown; Optional

locale_archive

Unknown; Optional

attribute_path

String; Optional

sh_posix_attributes

Unknown; Optional

List of attribute paths to extract standard Unix shell tools from. Passed to nixpkgs_sh_posix_configure.

nix_file

Unknown; Optional

nix_file_deps

List of strings; Optional

nixopts

Unknown; Optional

locale

Unknown; Optional

repositories

Unknown; Optional

repository

Unknown; Optional

nix_file_content

Unknown; Optional

Examples

haskell_register_ghc_nixpkgs(
    locale_archive = "@glibc_locales//:locale-archive",
    atttribute_path = "haskellPackages.ghc",
    version = "1.2.3",   # The version of GHC
)

Setting the host platform can be done on the command-line like in the following:

--host_platform=@rules_haskell//haskell/platforms:linux_x86_64_nixpkgs