Expose extension for Git toolchain (#967)

This move all toolchains into the rules_pkg_git repo.

* Expose extension
* Use extension in MODULE.bazel
diff --git a/MODULE.bazel b/MODULE.bazel
index 36e555e..601e36a 100644
--- a/MODULE.bazel
+++ b/MODULE.bazel
@@ -25,6 +25,15 @@
     dev_dependency = True,
 )
 
+# Find the system Git if one is available.
+find_git = use_extension("//toolchains/git:git_configure.bzl", "experimental_find_system_git_extension", dev_dependency = True)
+use_repo(find_git, "rules_pkg_git")
+
+register_toolchains(
+    "@rules_pkg_git//:all",
+    dev_dependency = True,
+)
+
 local_repository = use_repo_rule("@bazel_tools//tools/build_defs/repo:local.bzl", "local_repository")
 
 local_repository(
diff --git a/WORKSPACE.bzlmod b/WORKSPACE.bzlmod
index 6680fd5..b670788 100644
--- a/WORKSPACE.bzlmod
+++ b/WORKSPACE.bzlmod
@@ -13,16 +13,3 @@
 #    name = "rules_pkg_rpmbuild",
 #    verbose = False,
 #)
-
-# Needed for making our release notes
-load("//toolchains/git:git_configure.bzl", "experimental_find_system_git_bzlmod")
-
-experimental_find_system_git_bzlmod(
-    name = "rules_pkg_git",
-    verbose = False,
-)
-
-register_toolchains(
-    "@rules_pkg_git//:git_auto_toolchain",
-    "//toolchains/git:git_missing_toolchain",
-)
diff --git a/toolchains/git/BUILD b/toolchains/git/BUILD
index 7d1596e..8aa80cd 100644
--- a/toolchains/git/BUILD
+++ b/toolchains/git/BUILD
@@ -67,9 +67,3 @@
 git_toolchain(
     name = "no_git",
 )
-
-toolchain(
-    name = "git_missing_toolchain",
-    toolchain = ":no_git",
-    toolchain_type = ":git_toolchain_type",
-)
diff --git a/toolchains/git/BUILD.tpl b/toolchains/git/BUILD.tpl
index f009c1b..5c18a65 100644
--- a/toolchains/git/BUILD.tpl
+++ b/toolchains/git/BUILD.tpl
@@ -14,3 +14,9 @@
     toolchain = ":git_auto",
     toolchain_type = "@rules_pkg//toolchains/git:git_toolchain_type",
 )
+
+toolchain(
+    name = "zzz_git_missing_toolchain",  # keep name lexicographically last
+    toolchain = "@rules_pkg//toolchains/git:no_git",
+    toolchain_type = "@rules_pkg//toolchains/git:git_toolchain_type",
+)
diff --git a/toolchains/git/git_configure.bzl b/toolchains/git/git_configure.bzl
index f537c1a..e6850f6 100644
--- a/toolchains/git/git_configure.bzl
+++ b/toolchains/git/git_configure.bzl
@@ -74,8 +74,7 @@
         workspace_file = Label("//:WORKSPACE")
     _find_system_git(name = name, workspace_file = workspace_file, verbose = verbose)
     native.register_toolchains(
-        "@%s//:git_auto_toolchain" % name,
-        "@rules_pkg//toolchains/git:git_missing_toolchain",
+        "@%s//:all" % name,
     )
 
 # buildifier: disable=function-docstring-args
@@ -93,3 +92,8 @@
     if not workspace_file:
         workspace_file = Label("//:MODULE.bazel")
     _find_system_git(name = name, workspace_file = workspace_file, verbose = verbose)
+
+# For use from MODULE.bzl
+experimental_find_system_git_extension = module_extension(
+    implementation = lambda ctx: _find_system_git(name = "rules_pkg_git", workspace_file = Label("//:MODULE.bazel")),
+)