See example in https://github.com/abc-dp/rules_sops/blob/58927c53864c3d35f92e47de2651f9bfc11bfb11/sops/toolchain.bzl#L34
# Make the $(tool_BIN) variable available in places like genrules.
# See https://docs.bazel.build/versions/main/be/make-variables.html#custom_variables
template_variables = platform_common.TemplateVariableInfo({
"sops_BIN": target_tool_path,
})
See example in https://github.com/abc-dp/rules_sops/blob/58927c53864c3d35f92e47de2651f9bfc11bfb11/sops/toolchain.bzl#L34