From 67bd3cc9108dde4b47f6823a6b55897af1b9b4d4 Mon Sep 17 00:00:00 2001 From: Zane Dufour Date: Wed, 15 Jan 2025 23:46:03 -0500 Subject: [PATCH] tilt: add completions --- pkgs/by-name/ti/tilt/binary.nix | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/pkgs/by-name/ti/tilt/binary.nix b/pkgs/by-name/ti/tilt/binary.nix index 4c5e70520927f1..60421b81bd733e 100644 --- a/pkgs/by-name/ti/tilt/binary.nix +++ b/pkgs/by-name/ti/tilt/binary.nix @@ -4,9 +4,11 @@ src, version, tilt-assets, + stdenv, + installShellFiles, }: -buildGoModule rec { +(buildGoModule rec { pname = "tilt"; /* Do not use "dev" as a version. If you do, Tilt will consider itself @@ -21,11 +23,15 @@ buildGoModule rec { ldflags = [ "-X main.version=${version}" ]; + nativeBuildInputs = [ installShellFiles ]; + preBuild = '' mkdir -p pkg/assets/build cp -r ${tilt-assets}/* pkg/assets/build/ ''; + postInstall = ''''; + meta = { description = "Local development tool to manage your developer instance when your team deploys to Kubernetes in production"; mainProgram = "tilt"; @@ -33,4 +39,14 @@ buildGoModule rec { license = lib.licenses.asl20; maintainers = with lib.maintainers; [ anton-dessiatov ]; }; -} +}).overrideAttrs + (old: { + postInstall = + (old.postInstall or "") + + '' + installShellCompletion --cmd tilt \ + --bash <($out/bin/tilt completion bash) \ + --fish <($out/bin/tilt completion fish) \ + --zsh <($out/bin/tilt completion zsh) + ''; + })