Skip to content

Commit be0bf6b

Browse files
committed
Add rules_haskell_nix module
This module should be used with bzlmod to install nix based toolchains. This way the main rules_haskell module does not depend on rules_nixpkgs.
1 parent 8b5fb22 commit be0bf6b

11 files changed

+466
-414
lines changed

.bazelignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ tutorial
33
haskell/asterius/npm/node_modules
44
registry
55
rules_haskell_tests
6+
rules_haskell_nix

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/bazel-*
22
/rules_haskell_tests/bazel-*
3+
/rules_haskell_nix/bazel-*
34
.bazelrc.local
45
*.swp
56
*.swo

haskell/nixpkgs.bzl

Lines changed: 0 additions & 414 deletions
This file was deleted.

haskell/nixpkgs.bzl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../rules_haskell_nix/nixpkgs.bzl

rules_haskell_nix/.bazelrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
import %workspace%/../.bazelrc.common
2+
import %workspace%/.bazelrc.bzlmod

rules_haskell_nix/.bazelrc.bzlmod

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
common:bzlmod --experimental_enable_bzlmod
2+
common:bzlmod --registry=file://%workspace%/../registry --registry=https://bcr.bazel.build

rules_haskell_nix/BUILD.bazel

Whitespace-only changes.

rules_haskell_nix/MODULE.bazel

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
module(
2+
name = "rules_haskell_nix",
3+
version = "0.16",
4+
)
5+
6+
bazel_dep(
7+
name = "rules_haskell",
8+
version = "0.16",
9+
)
10+
11+
bazel_dep(
12+
name = "rules_nixpkgs_core",
13+
version = "0.9.0",
14+
)
15+
16+
bazel_dep(
17+
name = "rules_nixpkgs_posix",
18+
version = "0.9.0",
19+
)
20+
21+
bazel_dep(
22+
name = "platforms",
23+
version = "0.0.6",
24+
)
25+
26+
non_module_deps = use_extension("//:non_module_deps.bzl", "non_module_deps")
27+
28+
use_repo(non_module_deps, "os_info")

rules_haskell_nix/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
With bzlmod, the [nix functionalities](https://api.haskell.build/haskell/nixpkgs.html) provided by rules_haskell must be
2+
accessed via `@rules_haskell_nix//:nixpkgs.bzl`.
3+
4+
This way the main `rules_haskell` module does not have to depend on
5+
`rules_nixpkgs` when we do not intend to use nix toolchains.

rules_haskell_nix/WORKSPACE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# This WORKSPACE file is empty because the folder is only used as a repository with bzlmod

0 commit comments

Comments
 (0)