Skip to content

Commit

Permalink
Add rules_haskell_nix module
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ylecornec committed Jun 27, 2023
1 parent 8b5fb22 commit be0bf6b
Show file tree
Hide file tree
Showing 11 changed files with 466 additions and 414 deletions.
1 change: 1 addition & 0 deletions .bazelignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ tutorial
haskell/asterius/npm/node_modules
registry
rules_haskell_tests
rules_haskell_nix
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/bazel-*
/rules_haskell_tests/bazel-*
/rules_haskell_nix/bazel-*
.bazelrc.local
*.swp
*.swo
Expand Down
414 changes: 0 additions & 414 deletions haskell/nixpkgs.bzl

This file was deleted.

1 change: 1 addition & 0 deletions haskell/nixpkgs.bzl
2 changes: 2 additions & 0 deletions rules_haskell_nix/.bazelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import %workspace%/../.bazelrc.common
import %workspace%/.bazelrc.bzlmod
2 changes: 2 additions & 0 deletions rules_haskell_nix/.bazelrc.bzlmod
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
common:bzlmod --experimental_enable_bzlmod
common:bzlmod --registry=file://%workspace%/../registry --registry=https://bcr.bazel.build
Empty file added rules_haskell_nix/BUILD.bazel
Empty file.
28 changes: 28 additions & 0 deletions rules_haskell_nix/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
module(
name = "rules_haskell_nix",
version = "0.16",
)

bazel_dep(
name = "rules_haskell",
version = "0.16",
)

bazel_dep(
name = "rules_nixpkgs_core",
version = "0.9.0",
)

bazel_dep(
name = "rules_nixpkgs_posix",
version = "0.9.0",
)

bazel_dep(
name = "platforms",
version = "0.0.6",
)

non_module_deps = use_extension("//:non_module_deps.bzl", "non_module_deps")

use_repo(non_module_deps, "os_info")
5 changes: 5 additions & 0 deletions rules_haskell_nix/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
With bzlmod, the [nix functionalities](https://api.haskell.build/haskell/nixpkgs.html) provided by rules_haskell must be
accessed via `@rules_haskell_nix//:nixpkgs.bzl`.

This way the main `rules_haskell` module does not have to depend on
`rules_nixpkgs` when we do not intend to use nix toolchains.
1 change: 1 addition & 0 deletions rules_haskell_nix/WORKSPACE
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# This WORKSPACE file is empty because the folder is only used as a repository with bzlmod
Loading

0 comments on commit be0bf6b

Please sign in to comment.