From c956054ee6309e460a28affbf803570e72dd3ffd Mon Sep 17 00:00:00 2001 From: Aaron Siddhartha Mondal Date: Tue, 31 Dec 2024 10:10:10 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=9A=20Move=20toolchain=20registration?= =?UTF-8?q?=20to=20flake=20module?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Hardcoding toolchain registrations into MODULE.bazel is a bad practice. Moving it to the flake module makes the ll_toolchain "optional" and only enables it on systems that can run Nix. --- MODULE.bazel | 7 ++++--- modules/rules_ll.nix | 2 ++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/MODULE.bazel b/MODULE.bazel index 6fc05aa6..d976311b 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -4,8 +4,6 @@ module( compatibility_level = 0, ) -register_toolchains("@rules_ll//ll:ll_toolchain") - # Platform support. bazel_dep(name = "platforms", version = "0.0.10") bazel_dep(name = "rules_cc", version = "0.0.17") @@ -14,7 +12,10 @@ bazel_dep(name = "rules_cc", version = "0.0.17") bazel_dep(name = "bazel_skylib", version = "1.7.1") # Documentation. -bazel_dep(name = "stardoc", version = "0.7.2", dev_dependency = True) +# +# TODO(aaronmondal): This should be a dev_dependency, but that currently breaks +# the examples. +bazel_dep(name = "stardoc", version = "0.7.2", dev_dependency = False) # TODO(aaronmondal): We don't actually use this. Fix LRE upstream to make this # import optional. diff --git a/modules/rules_ll.nix b/modules/rules_ll.nix index fa592f34..852458db 100644 --- a/modules/rules_ll.nix +++ b/modules/rules_ll.nix @@ -12,6 +12,8 @@ let # Add try-import %%workspace%%/ll.bazelrc to your .bazelrc to # include these flags when running Bazel in a nix environment. + build --extra_toolchains=@rules_ll//ll:ll_toolchain + ${lib.concatLines processedActionEnvs}' >$out ''; in