diff --git a/pkgs/by-name/pr/prek/package.nix b/pkgs/by-name/pr/prek/package.nix index b3dd6ced7c50..5051634eba7f 100644 --- a/pkgs/by-name/pr/prek/package.nix +++ b/pkgs/by-name/pr/prek/package.nix @@ -1,7 +1,9 @@ { lib, + stdenv, fetchFromGitHub, rustPlatform, + installShellFiles, git, uv, python312, @@ -22,6 +24,10 @@ rustPlatform.buildRustPackage (finalAttrs: { cargoHash = "sha256-KOpQ3P9cmcWYT3bPKtKpzHPagX4b9hH0EiWGpt98NnE="; + nativeBuildInputs = [ + installShellFiles + ]; + nativeCheckInputs = [ git python312 @@ -180,6 +186,13 @@ rustPlatform.buildRustPackage (finalAttrs: { "version_info" ]; + postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' + installShellCompletion --cmd prek \ + --bash <(COMPLETE=bash $out/bin/prek) \ + --fish <(COMPLETE=fish $out/bin/prek) \ + --zsh <(COMPLETE=zsh $out/bin/prek) + ''; + doInstallCheck = true; nativeInstallCheckInputs = [ versionCheckHook ];