Vcs based versions in flakes

I maintain a number of tools across a few different languages, and they seem to have a different way to track and update version numbers. I am keen to add a root level flake that respects this toolchain native version, but it is sometimes harder than it ought be.

Some, like Javascript and Rust seem to prefer having you store your version string in a manifest file, package.json and Cargo.toml respectively. These work quite well with flakes, as the version can be slurped up via pure nix.

Unfortunately, other languages notably Go, use vcs information, specifically well structured semver tags, to be the canonical source of version information. This means if I am packaging a Go module, there is no way access the version string that the toolchain sees, as flakes do not store git ref data.

I understand the reasoning behind why you would like a given rev on refs/heads/trunk to resolve to the same as refs/heads/feature, and even why it would be nice for the flake to have the same hash between refs/heads/trunk and refs/tags/v0.1.0.

I have seen people check in a version file that must be kept in sync with their tags, ends up being very error prone, or use non-semver in their flakes, e.g. rolling release and date based, both of which mean nix becomes a second class builder to the primary toolchain.

I get that this is a non-problem for nixpkgs, since the vcs ref data is available as a string passed to fetchFromXxx, but it is worth noting that as we have more repos self hosting flakes, is there some middle ground that can be achieved for such packaging needs?