From 5330277dce2f10166030c11ec6166911cf962f7b Mon Sep 17 00:00:00 2001 From: Jonathan Davies Date: Sat, 11 Jul 2026 12:09:13 +0100 Subject: [PATCH] oha: Install shell completions --- pkgs/by-name/oh/oha/package.nix | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/pkgs/by-name/oh/oha/package.nix b/pkgs/by-name/oh/oha/package.nix index 3f884b8d6b21..33b7d35d2ef6 100644 --- a/pkgs/by-name/oh/oha/package.nix +++ b/pkgs/by-name/oh/oha/package.nix @@ -4,6 +4,7 @@ fetchFromGitHub, stdenv, cacert, + installShellFiles, libredirect, pkg-config, openssl, @@ -29,7 +30,10 @@ rustPlatform.buildRustPackage (finalAttrs: { CARGO_PROFILE_RELEASE_CODEGEN_UNITS = "1"; }; - nativeBuildInputs = lib.optionals stdenv.hostPlatform.isLinux [ + nativeBuildInputs = [ + installShellFiles + ] + ++ lib.optionals stdenv.hostPlatform.isLinux [ pkg-config ]; @@ -54,6 +58,12 @@ rustPlatform.buildRustPackage (finalAttrs: { "--skip=test_proxy" ]; + postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' + for shell in bash fish zsh; do + installShellCompletion --cmd oha --$shell <($out/bin/oha --completions $shell) + done + ''; + nativeInstallCheckInputs = [ versionCheckHook ];