summary refs log tree commit diff
path: root/pkgs/servers/tailscale
diff options
context:
space:
mode:
authorDanielle Lancashire <dani@builds.terrible.systems>2020-10-22 22:47:18 +0200
committerDanielle Lancashire <dani@builds.terrible.systems>2020-10-22 22:47:18 +0200
commit7526ae55d760294b8e93f87e5f541ce8e0501296 (patch)
tree721c9bf32e17a6b3a597be3457c3f77760a7f6bc /pkgs/servers/tailscale
parent5e67d80a8ba61fe0467b633c1cb63143c66a26a6 (diff)
downloadnixpkgs-7526ae55d760294b8e93f87e5f541ce8e0501296.tar
nixpkgs-7526ae55d760294b8e93f87e5f541ce8e0501296.tar.gz
nixpkgs-7526ae55d760294b8e93f87e5f541ce8e0501296.tar.bz2
nixpkgs-7526ae55d760294b8e93f87e5f541ce8e0501296.tar.lz
nixpkgs-7526ae55d760294b8e93f87e5f541ce8e0501296.tar.xz
nixpkgs-7526ae55d760294b8e93f87e5f541ce8e0501296.tar.zst
nixpkgs-7526ae55d760294b8e93f87e5f541ce8e0501296.zip
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
Diffstat (limited to 'pkgs/servers/tailscale')
-rw-r--r--pkgs/servers/tailscale/default.nix7
1 files changed, 7 insertions, 0 deletions
diff --git a/pkgs/servers/tailscale/default.nix b/pkgs/servers/tailscale/default.nix
index 32c0c84dd08..2e14b0fe7f8 100644
--- a/pkgs/servers/tailscale/default.nix
+++ b/pkgs/servers/tailscale/default.nix
@@ -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 ]