I finally figured it out how to do this (sort of). I was able to install rules_proto_grpc.
My issue was with using packaged older version of rules_go and g...@1.20. I have used dependency override (described in rules_proto_grpc).
With that extension it's very simple, basically creating a BUILD + .bzl files, where you pass through all the parameters to the plugin binary.
Quick note: in order to install a golang binary in bazel you need to use go_repository. You can add it manually to WORKSPACE, or, better yet, use gazelle update-repos
gazelle(
name = "gazelle-install",
args = [
"<package>@<version>",
],
command = "update-repos",
)
You can then do:
bazel query "@<package_repo_name>//:*"
to find all generated targets and choose the one you need and use it as binary in proto_plugin(..., tool = "@<package_repo_name>//:<binary target>", ...)
Hopefully my findings prove useful to someone. If you've got questions, I'd be happy to share more of my experience