From 9a6d638ba0219aee3f615bf2a5c32ad7d2195457 Mon Sep 17 00:00:00 2001 From: Andreas Herrmann Date: Tue, 18 Jun 2024 11:18:34 +0200 Subject: [PATCH] config Nix provided cc toolchain --- MODULE.bazel | 29 +++++++++++++++++++++++++++++ non_module_deps.bzl | 11 +++++++++++ 2 files changed, 40 insertions(+) create mode 100644 non_module_deps.bzl diff --git a/MODULE.bazel b/MODULE.bazel index de7d38d..3c646b7 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -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", +) diff --git a/non_module_deps.bzl b/non_module_deps.bzl new file mode 100644 index 0000000..20d5d75 --- /dev/null +++ b/non_module_deps.bzl @@ -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, +)