From 4814fd2154691c4d63c6b1cccf6dc2c9a3d0fcfb Mon Sep 17 00:00:00 2001 From: Aaron Jheng Date: Mon, 30 Mar 2026 13:06:30 +0800 Subject: [PATCH] crush: add shell completions support --- pkgs/by-name/cr/crush/package.nix | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/pkgs/by-name/cr/crush/package.nix b/pkgs/by-name/cr/crush/package.nix index 57a945d7e064..16dda53bbc41 100644 --- a/pkgs/by-name/cr/crush/package.nix +++ b/pkgs/by-name/cr/crush/package.nix @@ -1,7 +1,9 @@ { lib, + stdenv, buildGo126Module, fetchFromGitHub, + installShellFiles, nix-update-script, writableTmpDirAsHomeHook, versionCheckHook, @@ -25,6 +27,10 @@ buildGo126Module (finalAttrs: { "-X=github.com/charmbracelet/crush/internal/version.Version=${finalAttrs.version}" ]; + nativeBuildInputs = [ + installShellFiles + ]; + checkFlags = let # these tests fail in the sandbox @@ -44,6 +50,13 @@ buildGo126Module (finalAttrs: { nativeInstallCheckInputs = [ versionCheckHook ]; doInstallCheck = true; + postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' + installShellCompletion --cmd crush \ + --bash <($out/bin/crush completion bash) \ + --fish <($out/bin/crush completion fish) \ + --zsh <($out/bin/crush completion zsh) + ''; + updateScript = nix-update-script { }; meta = {