tailscale: Include version in build flags

This commit adds the user-facing version to the tailscale version
output.

Prior to this change, it used a hardcoded fallback that is fairly
infrequently updated (https://github.com/tailscale/tailscale/commits/main/version/version.go).

After this change, we print the user-friendlier tag version, which is
helpful when wanting to e.g check to see if you have a version that is
compatible with a feature like [magic dns][magic-dns].

E.g:

```
[nixpkgs(dani/tailscale-version)] $ ./result/bin/tailscale version
1.0.5
```

[magic-dns]: https://tailscale.com/kb/1081/magic-dns
This commit is contained in:
Danielle Lancashire 2020-10-22 22:47:18 +02:00
parent 5e67d80a8b
commit 7526ae55d7
No known key found for this signature in database
GPG key ID: 8D65584EF3DDF91B

View file

@ -21,6 +21,13 @@ buildGoModule rec {
subPackages = [ "cmd/tailscale" "cmd/tailscaled" ];
preBuild = ''
export buildFlagsArray=(
-tags="xversion"
-ldflags="-X tailscale.com/version.LONG=${version} -X tailscale.com/version.SHORT=${version}"
)
'';
postInstall = ''
wrapProgram $out/bin/tailscaled --prefix PATH : ${
lib.makeBinPath [ iproute iptables ]