diff --git a/.bazelrc b/.bazelrc
index 3455684b..ed593e90 100644
--- a/.bazelrc
+++ b/.bazelrc
@@ -1,24 +1,3 @@
-build:bzlmod --enable_bzlmod
-
-build --host_platform=@rules_nixpkgs_core//platforms:host
-
-# Using toolchain resolution can lead to spurious dependencies on
-# `@local_config_cc//:builtin_include_directory_paths`. This needs to be
-# resolved before `--incompatible_enable_cc_toolchain_resolution` can be
-# recommended for `nixpkgs_cc_configure_hermetic`.
-# build --incompatible_enable_cc_toolchain_resolution
-
-build --java_runtime_version=nixpkgs_java_11
-build --java_language_version=11
-build --tool_java_runtime_version=nixpkgs_java_11
-build --tool_java_language_version=11
-
-# The following lines provide a workaround for a test failure in on the Java
-# toolchain on MacOS 11, documented here: https://github.com/tweag/rules_nixpkgs/issues/299.
-# They should be removed as soon as that issue has been resolved.
-build --enable_platform_specific_config
-build:macos --experimental_strict_java_deps=warn
-
-# User Configuration
-# ------------------
-try-import %workspace%/.bazelrc.local
+import %workspace%/.bazelrc.common
+import %workspace%/.bazelrc.cc
+import %workspace%/.bazelrc.java
diff --git a/.bazelrc.cc b/.bazelrc.cc
new file mode 100644
index 00000000..86ba8f33
--- /dev/null
+++ b/.bazelrc.cc
@@ -0,0 +1,8 @@
+build --crosstool_top=@nixpkgs_config_cc//:toolchain
+# Using toolchain resolution can lead to spurious dependencies on
+# `@local_config_cc//:builtin_include_directory_paths`. This needs to be
+# resolved before `--incompatible_enable_cc_toolchain_resolution` can be
+# recommended for `nixpkgs_cc_configure_hermetic`.
+# build --incompatible_enable_cc_toolchain_resolution
+
+# vim: ft=conf
diff --git a/.bazelrc.common b/.bazelrc.common
new file mode 100644
index 00000000..83357d84
--- /dev/null
+++ b/.bazelrc.common
@@ -0,0 +1,10 @@
+build --host_platform=@rules_nixpkgs_core//platforms:host
+
+build:bzlmod --enable_bzlmod
+build:bzlmod --registry=https://bcr.bazel.build
+
+# User Configuration
+# ------------------
+try-import %workspace%/.bazelrc.local
+
+# vim: ft=conf
diff --git a/.bazelrc.java b/.bazelrc.java
new file mode 100644
index 00000000..83d96b4e
--- /dev/null
+++ b/.bazelrc.java
@@ -0,0 +1,18 @@
+# Bazel requires a Java runtime to run tests, so any module that contains tests
+# will need Java configuration. However, not all modules should have to depend
+# on rules_nixpkgs_java to provide a Java runtime, in particular the core
+# module should be free of this dependency. Hence, the Java configuration
+# exists in a separate configuration file.
+
+build --java_runtime_version=nixpkgs_java_11
+build --java_language_version=11
+build --tool_java_runtime_version=nixpkgs_java_11
+build --tool_java_language_version=11
+
+# The following lines provide a workaround for a test failure in on the Java
+# toolchain on MacOS 11, documented here: https://github.com/tweag/rules_nixpkgs/issues/299.
+# They should be removed as soon as that issue has been resolved.
+build --enable_platform_specific_config
+build:macos --experimental_strict_java_deps=warn
+
+# vim: ft=conf
diff --git a/.github/build-and-test b/.github/build-and-test
index f1c867d8..753a75c1 100755
--- a/.github/build-and-test
+++ b/.github/build-and-test
@@ -28,10 +28,12 @@ if [[ ${BZLMOD_ENABLED-} = true ]]; then
declare -ra build_dirs=(
core
toolchains/java
+ toolchains/posix
)
declare -ra test_dirs=(
testing/core
testing/java
+ testing/posix
)
declare -ra extra_flags=(
--config=bzlmod
@@ -51,6 +53,7 @@ else
toolchains/nodejs
testing/core
testing/java
+ testing/posix
)
declare -ra extra_flags=(
)
diff --git a/README.md b/README.md
index 6fd36d49..61b7f981 100644
--- a/README.md
+++ b/README.md
@@ -1743,7 +1743,7 @@ default is None
### nixpkgs_sh_posix_configure
-nixpkgs_sh_posix_configure(name, packages, exec_constraints, kwargs)
+nixpkgs_sh_posix_configure(name, packages, exec_constraints, register, kwargs)
Create a POSIX toolchain from nixpkgs.
@@ -1803,6 +1803,20 @@ default is None
Constraints for the execution platform.
+
+
+
+
+register |
+
+
+optional.
+default is True
+
+
+
+Automatically register the generated toolchain if set to True.
+
|
diff --git a/core/.bazelrc b/core/.bazelrc
index cc17469b..68d131c8 100644
--- a/core/.bazelrc
+++ b/core/.bazelrc
@@ -1,7 +1 @@
-build:bzlmod --enable_bzlmod
-
-build --host_platform=@rules_nixpkgs_core//platforms:host
-
-# User Configuration
-# ------------------
-try-import %workspace%/.bazelrc.local
+import %workspace%/../.bazelrc.common
diff --git a/testing/core/.bazelrc b/testing/core/.bazelrc
deleted file mode 120000
index c70ccda0..00000000
--- a/testing/core/.bazelrc
+++ /dev/null
@@ -1 +0,0 @@
-../../.bazelrc
\ No newline at end of file
diff --git a/testing/core/.bazelrc b/testing/core/.bazelrc
new file mode 100644
index 00000000..f7129798
--- /dev/null
+++ b/testing/core/.bazelrc
@@ -0,0 +1,2 @@
+import %workspace%/../../.bazelrc.common
+import %workspace%/../../.bazelrc.java
diff --git a/testing/java/.bazelrc b/testing/java/.bazelrc
deleted file mode 120000
index c70ccda0..00000000
--- a/testing/java/.bazelrc
+++ /dev/null
@@ -1 +0,0 @@
-../../.bazelrc
\ No newline at end of file
diff --git a/testing/java/.bazelrc b/testing/java/.bazelrc
new file mode 100644
index 00000000..f7129798
--- /dev/null
+++ b/testing/java/.bazelrc
@@ -0,0 +1,2 @@
+import %workspace%/../../.bazelrc.common
+import %workspace%/../../.bazelrc.java
diff --git a/testing/posix/.bazelrc b/testing/posix/.bazelrc
new file mode 100644
index 00000000..f7129798
--- /dev/null
+++ b/testing/posix/.bazelrc
@@ -0,0 +1,2 @@
+import %workspace%/../../.bazelrc.common
+import %workspace%/../../.bazelrc.java
diff --git a/testing/posix/BUILD.bazel b/testing/posix/BUILD.bazel
new file mode 100644
index 00000000..e69de29b
diff --git a/testing/posix/MODULE.bazel b/testing/posix/MODULE.bazel
new file mode 100644
index 00000000..a0ed63f0
--- /dev/null
+++ b/testing/posix/MODULE.bazel
@@ -0,0 +1,39 @@
+module(name = "rules_nixpkgs_posix_testing")
+
+bazel_dep(name = "rules_nixpkgs_posix")
+local_path_override(
+ module_name = "rules_nixpkgs_posix",
+ path = "../../toolchains/posix",
+)
+
+bazel_dep(name = "rules_nixpkgs_core")
+local_path_override(
+ module_name = "rules_nixpkgs_core",
+ path = "../../core",
+)
+
+bazel_dep(name = "rules_nixpkgs_java")
+local_path_override(
+ module_name = "rules_nixpkgs_java",
+ path = "../../toolchains/java",
+)
+
+bazel_dep(name = "bazel_skylib", version = "1.0.3")
+bazel_dep(name = "rules_sh", version = "0.3.0")
+
+# TODO[AH] Remove these transitive dependencies once nixpkgs_java_configure has
+# become a module extension in rules_nixpkgs_java.
+bazel_dep(name = "platforms", version = "0.0.4")
+bazel_dep(name = "rules_java", version = "4.0.0")
+
+java_toolchains = use_extension("@rules_java//java:extensions.bzl", "toolchains")
+use_repo(java_toolchains, "remote_java_tools")
+
+non_module_deps = use_extension("//:non_module_deps.bzl", "non_module_deps")
+use_repo(non_module_deps, "nixpkgs")
+use_repo(non_module_deps, "nixpkgs_sh_posix_config")
+use_repo(non_module_deps, "nixpkgs_sh_posix_config_toolchain")
+register_toolchains("@nixpkgs_sh_posix_config_toolchain//:nixpkgs_sh_posix_toolchain")
+# Bazel requries a Java runtime to run tests.
+use_repo(non_module_deps, "nixpkgs_java_runtime_toolchain")
+register_toolchains("@nixpkgs_java_runtime_toolchain//:all")
diff --git a/testing/posix/WORKSPACE b/testing/posix/WORKSPACE
new file mode 100644
index 00000000..18dd5a55
--- /dev/null
+++ b/testing/posix/WORKSPACE
@@ -0,0 +1,49 @@
+workspace(name = "rules_nixpkgs_posix_testing")
+
+local_repository(
+ name = "rules_nixpkgs_posix",
+ path = "../../toolchains/posix",
+)
+
+local_repository(
+ name = "rules_nixpkgs_core",
+ path = "../../core",
+)
+
+local_repository(
+ name = "rules_nixpkgs_java",
+ path = "../../toolchains/java",
+)
+
+load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
+
+http_archive(
+ name = "bazel_skylib",
+ sha256 = "f24ab666394232f834f74d19e2ff142b0af17466ea0c69a3f4c276ee75f6efce",
+ urls = [
+ "https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.4.0/bazel-skylib-1.4.0.tar.gz",
+ "https://github.com/bazelbuild/bazel-skylib/releases/download/1.4.0/bazel-skylib-1.4.0.tar.gz",
+ ],
+)
+
+load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace")
+
+bazel_skylib_workspace()
+
+http_archive(
+ name = "rules_sh",
+ sha256 = "d668bb32f112ead69c58bde2cae62f6b8acefe759a8c95a2d80ff6a85af5ac5e",
+ strip_prefix = "rules_sh-0.3.0",
+ urls = ["https://github.com/tweag/rules_sh/archive/v0.3.0.tar.gz"],
+)
+
+load("@rules_sh//sh:repositories.bzl", "rules_sh_dependencies")
+
+rules_sh_dependencies()
+
+load(
+ "//tests:nixpkgs_repositories.bzl",
+ "nixpkgs_repositories",
+)
+
+nixpkgs_repositories(bzlmod = False)
diff --git a/testing/posix/WORKSPACE.bzlmod b/testing/posix/WORKSPACE.bzlmod
new file mode 100644
index 00000000..e69de29b
diff --git a/testing/posix/flake.lock b/testing/posix/flake.lock
new file mode 120000
index 00000000..23b0a9b5
--- /dev/null
+++ b/testing/posix/flake.lock
@@ -0,0 +1 @@
+../../flake.lock
\ No newline at end of file
diff --git a/testing/posix/nixpkgs.nix b/testing/posix/nixpkgs.nix
new file mode 120000
index 00000000..ead0b005
--- /dev/null
+++ b/testing/posix/nixpkgs.nix
@@ -0,0 +1 @@
+../../docs/nixpkgs.nix
\ No newline at end of file
diff --git a/testing/posix/non_module_deps.bzl b/testing/posix/non_module_deps.bzl
new file mode 100644
index 00000000..1e758095
--- /dev/null
+++ b/testing/posix/non_module_deps.bzl
@@ -0,0 +1,11 @@
+load(
+ "//tests:nixpkgs_repositories.bzl",
+ "nixpkgs_repositories",
+)
+
+def _non_module_deps_impl(ctx):
+ nixpkgs_repositories(bzlmod = True)
+
+non_module_deps = module_extension(
+ implementation = _non_module_deps_impl,
+)
diff --git a/toolchains/posix/tests/BUILD.bazel b/testing/posix/tests/BUILD.bazel
similarity index 82%
rename from toolchains/posix/tests/BUILD.bazel
rename to testing/posix/tests/BUILD.bazel
index 724cc0bc..38072526 100644
--- a/toolchains/posix/tests/BUILD.bazel
+++ b/testing/posix/tests/BUILD.bazel
@@ -1,3 +1,5 @@
+load(":posix-test.bzl", "posix_test_suite")
+
package(default_testonly = 1)
# Test nixpkgs_sh_posix_configure() checking that Unix commands are in Nix store.
@@ -13,3 +15,5 @@ sh_test(
],
toolchains = ["@rules_sh//sh/posix:make_variables"],
)
+
+posix_test_suite(name = "posix-test")
diff --git a/testing/posix/tests/nixpkgs_repositories.bzl b/testing/posix/tests/nixpkgs_repositories.bzl
new file mode 100644
index 00000000..a44f8f49
--- /dev/null
+++ b/testing/posix/tests/nixpkgs_repositories.bzl
@@ -0,0 +1,26 @@
+load("@rules_nixpkgs_core//:nixpkgs.bzl", "nixpkgs_local_repository")
+load("@rules_nixpkgs_java//:java.bzl", "nixpkgs_java_configure")
+load("@rules_nixpkgs_posix//:posix.bzl", "nixpkgs_sh_posix_configure")
+
+def nixpkgs_repositories(*, bzlmod):
+ nixpkgs_local_repository(
+ name = "nixpkgs",
+ nix_file = "//:nixpkgs.nix",
+ nix_file_deps = ["//:flake.lock"],
+ )
+
+ nixpkgs_java_configure(
+ name = "nixpkgs_java_runtime",
+ attribute_path = "jdk11.home",
+ repository = "@nixpkgs",
+ toolchain = True,
+ register = not bzlmod,
+ toolchain_name = "nixpkgs_java",
+ toolchain_version = "11",
+ )
+
+ nixpkgs_sh_posix_configure(
+ name = "nixpkgs_sh_posix_config",
+ repository = "@nixpkgs",
+ register = not bzlmod,
+ )
diff --git a/testing/posix/tests/posix-test.bzl b/testing/posix/tests/posix-test.bzl
new file mode 100644
index 00000000..fbd1ab22
--- /dev/null
+++ b/testing/posix/tests/posix-test.bzl
@@ -0,0 +1,38 @@
+load("@bazel_skylib//lib:unittest.bzl", "asserts", "unittest")
+load("@nixpkgs_sh_posix_config//:nixpkgs_sh_posix.bzl", "discovered")
+
+ResolvedPosixToolchainInfo = provider()
+
+def _posix_toolchain_impl(ctx):
+ posix = ctx.toolchains["@rules_sh//sh/posix:toolchain_type"]
+ return [
+ ResolvedPosixToolchainInfo(commands = posix.commands)
+ ]
+
+_posix_toolchain = rule(
+ _posix_toolchain_impl,
+ toolchains = ["@rules_sh//sh/posix:toolchain_type"],
+)
+
+def _posix_runtime_test_impl(ctx):
+ env = unittest.begin(ctx)
+
+ commands = ctx.attr.toolchain[ResolvedPosixToolchainInfo].commands
+ for (command, path) in commands.items():
+ asserts.equals(env, path, discovered.get(command), "expected path to {} to match".format(command))
+
+ return unittest.end(env)
+
+_posix_runtime_test = unittest.make(
+ _posix_runtime_test_impl,
+ attrs = {
+ "toolchain": attr.label(),
+ },
+)
+
+def posix_test_suite(name):
+ _posix_toolchain(name = "posix-toolchain")
+ unittest.suite(
+ name,
+ lambda name: _posix_runtime_test(name = name, toolchain = ":posix-toolchain")
+ )
diff --git a/toolchains/posix/tests/test_posix_toolchain.sh b/testing/posix/tests/test_posix_toolchain.sh
similarity index 100%
rename from toolchains/posix/tests/test_posix_toolchain.sh
rename to testing/posix/tests/test_posix_toolchain.sh
diff --git a/toolchains/cc/.bazelrc b/toolchains/cc/.bazelrc
index d795bb99..ae8f32bd 100644
--- a/toolchains/cc/.bazelrc
+++ b/toolchains/cc/.bazelrc
@@ -1,23 +1,3 @@
-build --host_platform=@rules_nixpkgs_core//platforms:host
-
-build --crosstool_top=@nixpkgs_config_cc//:toolchain
-# Using toolchain resolution can lead to spurious dependencies on
-# `@local_config_cc//:builtin_include_directory_paths`. This needs to be
-# resolved before `--incompatible_enable_cc_toolchain_resolution` can be
-# recommended for `nixpkgs_cc_configure_hermetic`.
-# build --incompatible_enable_cc_toolchain_resolution
-
-build --java_runtime_version=nixpkgs_java_11
-build --java_language_version=11
-build --tool_java_runtime_version=nixpkgs_java_11
-build --tool_java_language_version=11
-
-# The following lines provide a workaround for a test failure in on the Java
-# toolchain on MacOS 11, documented here: https://github.com/tweag/rules_nixpkgs/issues/299.
-# They should be removed as soon as that issue has been resolved.
-build --enable_platform_specific_config
-build:macos --experimental_strict_java_deps=warn
-
-# User Configuration
-# ------------------
-try-import %workspace%/.bazelrc.local
+import %workspace%/../../.bazelrc.common
+import %workspace%/../../.bazelrc.cc
+import %workspace%/../../.bazelrc.java
diff --git a/toolchains/go/.bazelrc b/toolchains/go/.bazelrc
index d795bb99..ae8f32bd 100644
--- a/toolchains/go/.bazelrc
+++ b/toolchains/go/.bazelrc
@@ -1,23 +1,3 @@
-build --host_platform=@rules_nixpkgs_core//platforms:host
-
-build --crosstool_top=@nixpkgs_config_cc//:toolchain
-# Using toolchain resolution can lead to spurious dependencies on
-# `@local_config_cc//:builtin_include_directory_paths`. This needs to be
-# resolved before `--incompatible_enable_cc_toolchain_resolution` can be
-# recommended for `nixpkgs_cc_configure_hermetic`.
-# build --incompatible_enable_cc_toolchain_resolution
-
-build --java_runtime_version=nixpkgs_java_11
-build --java_language_version=11
-build --tool_java_runtime_version=nixpkgs_java_11
-build --tool_java_language_version=11
-
-# The following lines provide a workaround for a test failure in on the Java
-# toolchain on MacOS 11, documented here: https://github.com/tweag/rules_nixpkgs/issues/299.
-# They should be removed as soon as that issue has been resolved.
-build --enable_platform_specific_config
-build:macos --experimental_strict_java_deps=warn
-
-# User Configuration
-# ------------------
-try-import %workspace%/.bazelrc.local
+import %workspace%/../../.bazelrc.common
+import %workspace%/../../.bazelrc.cc
+import %workspace%/../../.bazelrc.java
diff --git a/toolchains/java/.bazelrc b/toolchains/java/.bazelrc
index a3a707ee..98dcb538 100644
--- a/toolchains/java/.bazelrc
+++ b/toolchains/java/.bazelrc
@@ -1,28 +1,6 @@
-build:bzlmod --enable_bzlmod
-build:bzlmod --registry=file://%workspace%/../../registry
-build:bzlmod --registry=https://bcr.bazel.build
# Skip docs directories in bzlmod mode. Stardoc is not yet bzlmod compatible.
build:bzlmod --deleted_packages=docs
+build:bzlmod --registry=file://%workspace%/../../registry
-build --host_platform=@rules_nixpkgs_core//platforms:host
-
-# Using toolchain resolution can lead to spurious dependencies on
-# `@local_config_cc//:builtin_include_directory_paths`. This needs to be
-# resolved before `--incompatible_enable_cc_toolchain_resolution` can be
-# recommended for `nixpkgs_cc_configure_hermetic`.
-# build --incompatible_enable_cc_toolchain_resolution
-
-build --java_runtime_version=nixpkgs_java_11
-build --java_language_version=11
-build --tool_java_runtime_version=nixpkgs_java_11
-build --tool_java_language_version=11
-
-# The following lines provide a workaround for a test failure in on the Java
-# toolchain on MacOS 11, documented here: https://github.com/tweag/rules_nixpkgs/issues/299.
-# They should be removed as soon as that issue has been resolved.
-build --enable_platform_specific_config
-build:macos --experimental_strict_java_deps=warn
-
-# User Configuration
-# ------------------
-try-import %workspace%/.bazelrc.local
+import %workspace%/../../.bazelrc.common
+import %workspace%/../../.bazelrc.java
diff --git a/toolchains/nodejs/.bazelrc b/toolchains/nodejs/.bazelrc
deleted file mode 120000
index c70ccda0..00000000
--- a/toolchains/nodejs/.bazelrc
+++ /dev/null
@@ -1 +0,0 @@
-../../.bazelrc
\ No newline at end of file
diff --git a/toolchains/nodejs/.bazelrc b/toolchains/nodejs/.bazelrc
new file mode 100644
index 00000000..ae8f32bd
--- /dev/null
+++ b/toolchains/nodejs/.bazelrc
@@ -0,0 +1,3 @@
+import %workspace%/../../.bazelrc.common
+import %workspace%/../../.bazelrc.cc
+import %workspace%/../../.bazelrc.java
diff --git a/toolchains/posix/.bazelrc b/toolchains/posix/.bazelrc
deleted file mode 120000
index c70ccda0..00000000
--- a/toolchains/posix/.bazelrc
+++ /dev/null
@@ -1 +0,0 @@
-../../.bazelrc
\ No newline at end of file
diff --git a/toolchains/posix/.bazelrc b/toolchains/posix/.bazelrc
new file mode 100644
index 00000000..98dcb538
--- /dev/null
+++ b/toolchains/posix/.bazelrc
@@ -0,0 +1,6 @@
+# Skip docs directories in bzlmod mode. Stardoc is not yet bzlmod compatible.
+build:bzlmod --deleted_packages=docs
+build:bzlmod --registry=file://%workspace%/../../registry
+
+import %workspace%/../../.bazelrc.common
+import %workspace%/../../.bazelrc.java
diff --git a/toolchains/posix/MODULE.bazel b/toolchains/posix/MODULE.bazel
index 869b8767..0048bef2 100644
--- a/toolchains/posix/MODULE.bazel
+++ b/toolchains/posix/MODULE.bazel
@@ -5,3 +5,4 @@ module(
bazel_dep(name = "rules_nixpkgs_core", version = "0.9.0")
bazel_dep(name = "rules_sh", version = "0.3.0")
+bazel_dep(name = "bazel_skylib", version = "1.0.3")
diff --git a/toolchains/posix/README.md b/toolchains/posix/README.md
index d055a761..65e2e577 100644
--- a/toolchains/posix/README.md
+++ b/toolchains/posix/README.md
@@ -16,7 +16,7 @@ Rules for importing a POSIX toolchain from Nixpkgs.
### nixpkgs_sh_posix_configure
-nixpkgs_sh_posix_configure(name, packages, exec_constraints, kwargs)
+nixpkgs_sh_posix_configure(name, packages, exec_constraints, register, kwargs)
Create a POSIX toolchain from nixpkgs.
@@ -76,6 +76,20 @@ default is None
Constraints for the execution platform.
+
+
+
+
+register |
+
+
+optional.
+default is True
+
+
+
+Automatically register the generated toolchain if set to True.
+
|
diff --git a/toolchains/posix/posix.bzl b/toolchains/posix/posix.bzl
index c6bbbc32..50b50f59 100644
--- a/toolchains/posix/posix.bzl
+++ b/toolchains/posix/posix.bzl
@@ -138,6 +138,7 @@ def nixpkgs_sh_posix_configure(
name = "nixpkgs_sh_posix_config",
packages = ["stdenv.initialPath"],
exec_constraints = None,
+ register = True,
**kwargs):
"""Create a POSIX toolchain from nixpkgs.
@@ -157,6 +158,7 @@ def nixpkgs_sh_posix_configure(
repository: See nixpkgs_package.
nixopts: See nixpkgs_package.
fail_not_supported: See nixpkgs_package.
+ register: Automatically register the generated toolchain if set to True.
"""
nixpkgs_sh_posix_config(
name = name,
@@ -170,6 +172,7 @@ def nixpkgs_sh_posix_configure(
name = name + "_toolchain",
workspace = name,
)
- native.register_toolchains(
- "@{}//:nixpkgs_sh_posix_toolchain".format(name + "_toolchain"),
- )
+ if register:
+ native.register_toolchains(
+ "@{}//:nixpkgs_sh_posix_toolchain".format(name + "_toolchain"),
+ )
diff --git a/toolchains/python/.bazelrc b/toolchains/python/.bazelrc
deleted file mode 120000
index c70ccda0..00000000
--- a/toolchains/python/.bazelrc
+++ /dev/null
@@ -1 +0,0 @@
-../../.bazelrc
\ No newline at end of file
diff --git a/toolchains/python/.bazelrc b/toolchains/python/.bazelrc
new file mode 100644
index 00000000..ae8f32bd
--- /dev/null
+++ b/toolchains/python/.bazelrc
@@ -0,0 +1,3 @@
+import %workspace%/../../.bazelrc.common
+import %workspace%/../../.bazelrc.cc
+import %workspace%/../../.bazelrc.java
diff --git a/toolchains/rust/.bazelrc b/toolchains/rust/.bazelrc
deleted file mode 120000
index c70ccda0..00000000
--- a/toolchains/rust/.bazelrc
+++ /dev/null
@@ -1 +0,0 @@
-../../.bazelrc
\ No newline at end of file
diff --git a/toolchains/rust/.bazelrc b/toolchains/rust/.bazelrc
new file mode 100644
index 00000000..ae8f32bd
--- /dev/null
+++ b/toolchains/rust/.bazelrc
@@ -0,0 +1,3 @@
+import %workspace%/../../.bazelrc.common
+import %workspace%/../../.bazelrc.cc
+import %workspace%/../../.bazelrc.java