nixpkgs/pkgs/servers/tailscale/default.nix

48 lines
1.4 KiB
Nix
Raw Normal View History

{ lib, buildGoModule, fetchFromGitHub, makeWrapper, iptables, iproute }:
buildGoModule rec {
pname = "tailscale";
2021-02-12 00:45:45 +01:00
version = "1.4.4";
tagHash = "f40ccb086c4c3f09b3cc67b7c559bd2c5d3cf953"; # from `git rev-parse v1.4.4`
src = fetchFromGitHub {
owner = "tailscale";
repo = "tailscale";
rev = "v${version}";
2021-02-12 00:45:45 +01:00
sha256 = "sha256-zrKkBbsvIqJkPysKx3nJ3EIbePWMZCX9eegekAoqMqk=";
};
nativeBuildInputs = [ makeWrapper ];
CGO_ENABLED = 0;
2021-02-12 00:45:45 +01:00
vendorSha256 = "sha256-WvojOnGQ/ssBkoQwIlOVsaEUJmi2ugqgtTAVKJg8Spk=";
doCheck = false;
subPackages = [ "cmd/tailscale" "cmd/tailscaled" ];
preBuild = ''
export buildFlagsArray=(
-tags="xversion"
2020-11-04 02:25:01 +01:00
-ldflags="-X tailscale.com/version.Long=${version} -X tailscale.com/version.Short=${version} -X tailscale.com/version.GitCommit=${tagHash}"
)
'';
postInstall = ''
wrapProgram $out/bin/tailscaled --prefix PATH : ${
lib.makeBinPath [ iproute iptables ]
}
sed -i -e "s#/usr/sbin#$out/bin#" -e "/^EnvironmentFile/d" ./cmd/tailscaled/tailscaled.service
install -D -m0444 -t $out/lib/systemd/system ./cmd/tailscaled/tailscaled.service
'';
meta = with lib; {
homepage = "https://tailscale.com";
description = "The node agent for Tailscale, a mesh VPN built on WireGuard";
platforms = platforms.linux;
license = licenses.bsd3;
maintainers = with maintainers; [ danderson mbaillie ];
};
}