diff --git a/pkgs/by-name/ko/koji/package.nix b/pkgs/by-name/ko/koji/package.nix index fb3729958667..42f605d553c1 100644 --- a/pkgs/by-name/ko/koji/package.nix +++ b/pkgs/by-name/ko/koji/package.nix @@ -1,45 +1,74 @@ { lib, + stdenv, rustPlatform, fetchFromGitHub, pkg-config, perl, udev, openssl, + gitMinimal, + writableTmpDirAsHomeHook, + installShellFiles, + versionCheckHook, }: -rustPlatform.buildRustPackage rec { +rustPlatform.buildRustPackage (finalAttrs: { pname = "koji"; - version = "2.2.0"; + version = "3.2.0"; src = fetchFromGitHub { - owner = "its-danny"; + owner = "cococonscious"; repo = "koji"; - rev = version; - hash = "sha256-2kBjHX7izo4loJ8oyPjE9FtCvUODC3Sm4T8ETIdeGZM="; + tag = "v${finalAttrs.version}"; + hash = "sha256-+xtq4btFbOfiyFMDHXo6riSBMhAwTLQFuE91MUHtg5Q="; }; useFetchCargoVendor = true; - cargoHash = "sha256-ZHti7nMfHiYur1kjxj+ySIF4/l0UU9q2urabUWZyk6E="; + cargoHash = "sha256-WiFXDXLJc2ictv29UoRFRpIpAqeJlEBEOvThXhLXLJA="; OPENSSL_NO_VENDOR = 1; nativeBuildInputs = [ pkg-config perl - udev + installShellFiles ]; buildInputs = [ - openssl.dev + openssl + ] ++ lib.optionals stdenv.hostPlatform.isLinux [ udev ]; + + nativeCheckInputs = [ + gitMinimal + writableTmpDirAsHomeHook ]; - meta = with lib; { + preCheck = '' + git config --global user.name 'nix-user' + git config --global user.email 'nix-user@example.com' + ''; + + postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' + installShellCompletion --cmd koji \ + --bash <($out/bin/koji completions bash) \ + --fish <($out/bin/koji completions fish) \ + --zsh <($out/bin/koji completions zsh) + ''; + + doInstallCheck = true; + nativeInstallCheckInputs = [ versionCheckHook ]; + versionCheckProgram = "${placeholder "out"}/bin/${finalAttrs.meta.mainProgram}"; + + meta = { description = "Interactive CLI for creating conventional commits"; homepage = "https://github.com/its-danny/koji"; - license = with licenses; [ mit ]; - maintainers = with maintainers; [ ByteSudoer ]; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ + ByteSudoer + WeetHet + ]; mainProgram = "koji"; - platforms = platforms.unix; + platforms = lib.platforms.unix; }; -} +})