--- a/.bazelrc
+++ b/.bazelrc
@@ -94,3 +94,5 @@ test:ci-windows --test_env=JAVA_HOME
 test:ci-windows --test_env=TEST_INSTALL_BASE=C:/b/bazeltest_install_base
 test:ci-windows --test_env=REPOSITORY_CACHE=C:/b/bazeltest_repo_cache
 test:ci-windows --test_tag_filters=-no_windows,-slow
+
+common --extra_toolchains=//xbps_src:non_prebuilt_java_21_toolchain_definition
--- a/scripts/BUILD
+++ b/scripts/BUILD
@@ -12,7 +12,7 @@ genrule(
     outs = ["bazel-complete.bash"],
     cmd = " ".join([
         "$(location :generate_bash_completion.sh)",
-        "--bazel=$(location //src:bazel)",
+        "--bazel=$(location //src:bazel_nojdk)",
         "--output=$@",
         "--prepend=$(location bazel-complete-header.bash)",
         "--prepend=$(location bazel-complete-template.bash)",
@@ -20,7 +20,7 @@ genrule(
     output_to_bindir = 1,
     tools = [
         ":generate_bash_completion.sh",
-        "//src:bazel",
+        "//src:bazel_nojdk",
     ],
     visibility = [
         "//scripts/packages:__subpackages__",
@@ -105,12 +105,12 @@ genrule(
     outs = ["bazel.fish"],
     cmd = " ".join([
         "$(location :generate_fish_completion)",
-        "--bazel=$(location //src:bazel)",
+        "--bazel=$(location //src:bazel_nojdk)",
         "--output=$@",
     ]),
     tools = [
         ":generate_fish_completion",
-        "//src:bazel",
+        "//src:bazel_nojdk",
     ],
     visibility = ["//scripts/packages:__subpackages__"],
 )
--- /dev/null
+++ b/xbps_src/BUILD.bazel
@@ -0,0 +1,11 @@
+load("@rules_java//toolchains:default_java_toolchain.bzl", "default_java_toolchain")
+
+default_java_toolchain(
+    name = "non_prebuilt_java_21_toolchain",
+    header_compiler_direct = "@remote_java_tools//:TurbineDirect",
+    ijar = "//third_party/ijar:ijar",
+    java_runtime = "@local_jdk//:jdk",
+    singlejar = "//src/tools/singlejar:singlejar",
+    source_version = "21",
+    target_version = "21",
+)
