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 = {