From 2d89afe56863a1c9312251146dc82d3cddf8f31b Mon Sep 17 00:00:00 2001 From: Aly Raffauf Date: Sat, 18 Jul 2026 13:46:32 -0400 Subject: [PATCH] nix/tg: add shell completion installation --- nix/tg.nix | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/nix/tg.nix b/nix/tg.nix index 16b5208..27ea9fb 100644 --- a/nix/tg.nix +++ b/nix/tg.nix @@ -1,7 +1,9 @@ { buildGoModule, lib, + installShellFiles, makeWrapper, + stdenv, git, }: buildGoModule { @@ -12,10 +14,19 @@ buildGoModule { subPackages = ["cmd/tg"]; env.CGO_ENABLED = "0"; - nativeBuildInputs = [makeWrapper]; + nativeBuildInputs = [ + installShellFiles + makeWrapper + ]; postInstall = '' wrapProgram $out/bin/tg --prefix PATH : ${lib.makeBinPath [git]} + '' + + lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' + installShellCompletion --cmd tg \ + --bash <($out/bin/tg completion bash) \ + --fish <($out/bin/tg completion fish) \ + --zsh <($out/bin/tg completion zsh) ''; ldflags = [ -- 2.51.2