-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #556 from tweag/guide-bzlmod
guide: bzlmod version of example
- Loading branch information
Showing
5 changed files
with
53 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
import %workspace%/../../.bazelrc.remote-cache | ||
|
||
build --noenable_bzlmod | ||
build --host_platform=@io_tweag_rules_nixpkgs//nixpkgs/platforms:host | ||
build --host_platform=@rules_nixpkgs_core//platforms:host | ||
build --crosstool_top=@nixpkgs_config_cc//:toolchain | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
.direnv/ | ||
bazel-*/ | ||
MODULE.bazel.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
module(name = "rules_nixpkgs_guide") | ||
|
||
bazel_dep(name = "rules_nixpkgs_core") | ||
# Remove to use rules_nixpkgs_core from the BCR | ||
local_path_override( | ||
module_name = "rules_nixpkgs_core", | ||
path = "../../core", | ||
) | ||
|
||
nix_repo = use_extension("@rules_nixpkgs_core//extensions:repository.bzl", "nix_repo") | ||
nix_repo.file( | ||
name = "nixpkgs", | ||
file = "//:nixpkgs.nix", | ||
file_deps = ["//:flake.lock"], | ||
) | ||
use_repo(nix_repo, "nixpkgs") | ||
|
||
bazel_dep(name = "rules_nixpkgs_cc") | ||
# Replace by archive_override to download a rules_nixpkgs_cc revision. | ||
# (rules_nixpkgs_cc is not available on the BCR, yet.) | ||
# | ||
# archive_override( | ||
# module_name = "rules_nixpkgs_cc", | ||
# urls = ["https://github.com/tweag/rules_nixpkgs/releases/download/v0.11.1/rules_nixpkgs-0.11.1.tar.gz"], | ||
# integrity = "sha256-KlVTSNf4WT/KK/P8bOU8XWKSnegbbCkuI/FsVXwK5Fo=", | ||
# strip_prefix = "rules_nixpkgs-0.11.1/toolchains/cc", | ||
# ) | ||
local_path_override( | ||
module_name = "rules_nixpkgs_cc", | ||
path = "../../toolchains/cc", | ||
) | ||
|
||
# TODO remove transitive rules_nixpkgs_cc dependencies. | ||
# Once there is a module extension for the cc toolchain. | ||
bazel_dep(name = "bazel_skylib", version = "1.7.1") | ||
bazel_dep(name = "rules_cc", version = "0.0.4") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
load("@rules_nixpkgs_cc//:cc.bzl", "nixpkgs_cc_configure") | ||
|
||
# TODO Use module extension once available. | ||
nixpkgs_cc_configure( | ||
name = "nixpkgs_config_cc", | ||
repository = "@nixpkgs", | ||
) |