Git tags in flakes inputs

I’m trying to use a git tag in a flake input like so:

{ inputs.myInput.url = "git+ssh://"; }

However this fails with

fetching Git repository 'ssh://’fatal: couldn’t find remote ref refs/heads/2.0

That’s expected since the tag is in refs/tags, which Nix (2.11.1) doesn’t seem to look into. However the docs mention that ref can be a git tag:

ref: A Git or Mercurial branch or tag name.

Am I doing something wrong?

I ran into this today - in case somebody else stumbles across it during a search, you can solve this using this technique, which is to replace {tagname} with refs/tags/{tagname}. I’m using annotated tags.

1 Like