Merge pull request #319894 from peterablehmann/tailscale

tailscale: add shell completions
This commit is contained in:
Pol Dellaiera 2024-06-16 22:20:46 +02:00 committed by GitHub
commit ca3274ea13
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -10,6 +10,7 @@
, shadow
, procps
, nixosTests
, installShellFiles
}:
let
@ -37,7 +38,7 @@ buildGoModule {
vendorHash = "sha256-SUjoeOFYz6zbEgv/vND7kEXbuWlZDrUKF2Dmqsf/KVw=";
nativeBuildInputs = lib.optionals stdenv.isLinux [ makeWrapper ];
nativeBuildInputs = lib.optionals stdenv.isLinux [ makeWrapper ] ++ [ installShellFiles ];
CGO_ENABLED = 0;
@ -63,6 +64,12 @@ buildGoModule {
--prefix PATH : ${lib.makeBinPath [ iproute2 iptables getent shadow ]} \
--suffix PATH : ${lib.makeBinPath [ procps ]}
local INSTALL="$out/bin/tailscale"
installShellCompletion --cmd tailscale \
--bash <($out/bin/tailscale completion bash) \
--fish <($out/bin/tailscale completion fish) \
--zsh <($out/bin/tailscale completion zsh)
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
'';