Skip to content

Commit

Permalink
config Nix provided cc toolchain
Browse files Browse the repository at this point in the history
  • Loading branch information
aherrmann committed Jun 18, 2024
1 parent cfae0e1 commit 9a6d638
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
29 changes: 29 additions & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,32 @@ nix_repo.nixpkgs_local_repository(
nix_file = "//:nixpkgs.nix",
)
use_repo(nix_repo, "nixpkgs")

http_archive = use_repo_rule(
"@bazel_tools//:http.bzl",
"http_archive",
dev_dependency = True,
)

http_archive(
name = "rules_nixpkgs_cc",
sha256 = "0000000000000000000000000000000000000000000000000000000000000000",
strip_prefix = "rules_nixpkgs-0.11.1/toolchains/cc",
urls = ["https://github.com/tweag/rules_nixpkgs/releases/download/v0.11.1/rules_nixpkgs-0.11.1.tar.gz"],
)

non_modules_deps = use_extension(
"//:non_module_deps.bzl",
"non_module_deps",
dev_dependency = True,
)
use_repo(
non_module_deps,
"nixpkgs_config_cc",
"nixpkgs_config_cc_info",
"nixpkgs_config_cc_toolchains",
)

register_toolchains(
"@nixpkgs_config_cc_toolchains//:all",
)
11 changes: 11 additions & 0 deletions non_module_deps.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
load("@rules_nixpkgs_cc//:cc.bzl", "nixpkgs_cc_configure")

def _non_module_deps_impl(_ctx):
nixpkgs_cc_configure(
repository = "@nixpkgs",
register = False,
)

non_module_deps = module_extension(
implementation = _non_module_deps_impl,
)

0 comments on commit 9a6d638

Please sign in to comment.