From 7526ae55d760294b8e93f87e5f541ce8e0501296 Mon Sep 17 00:00:00 2001 From: Danielle Lancashire Date: Thu, 22 Oct 2020 22:47:18 +0200 Subject: [PATCH] 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 --- pkgs/servers/tailscale/default.nix | 7 +++++++ 1 file changed, 7 insertions(+) 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 ]