From 95f5b2d446f04db328d9a3dfe495d9e9188d93cc Mon Sep 17 00:00:00 2001 From: WeetHet Date: Thu, 3 Apr 2025 17:32:02 +0300 Subject: [PATCH 1/3] koji: add WeetHet to maintainers --- pkgs/by-name/ko/koji/package.nix | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/pkgs/by-name/ko/koji/package.nix b/pkgs/by-name/ko/koji/package.nix index fb3729958667..a8790f348275 100644 --- a/pkgs/by-name/ko/koji/package.nix +++ b/pkgs/by-name/ko/koji/package.nix @@ -34,12 +34,15 @@ rustPlatform.buildRustPackage rec { openssl.dev ]; - meta = with lib; { + 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; }; } From 4c0eb34244eb2270b31901968dec7642df4eee61 Mon Sep 17 00:00:00 2001 From: WeetHet Date: Thu, 3 Apr 2025 17:34:57 +0300 Subject: [PATCH 2/3] koji: 2.2.0 -> 3.2.0 --- pkgs/by-name/ko/koji/package.nix | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/pkgs/by-name/ko/koji/package.nix b/pkgs/by-name/ko/koji/package.nix index a8790f348275..414d9623131e 100644 --- a/pkgs/by-name/ko/koji/package.nix +++ b/pkgs/by-name/ko/koji/package.nix @@ -1,39 +1,51 @@ { lib, + stdenv, rustPlatform, fetchFromGitHub, pkg-config, perl, udev, openssl, + gitMinimal, + writableTmpDirAsHomeHook, }: -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 ]; buildInputs = [ - openssl.dev + openssl + ] ++ lib.optionals stdenv.hostPlatform.isLinux [ udev ]; + + nativeCheckInputs = [ + gitMinimal + writableTmpDirAsHomeHook ]; + preCheck = '' + git config --global user.name 'nix-user' + git config --global user.email 'nix-user@example.com' + ''; + meta = { description = "Interactive CLI for creating conventional commits"; homepage = "https://github.com/its-danny/koji"; @@ -45,4 +57,4 @@ rustPlatform.buildRustPackage rec { mainProgram = "koji"; platforms = lib.platforms.unix; }; -} +}) From 798b0863a6a6d3feaf1dabda9bdc6d14c211c979 Mon Sep 17 00:00:00 2001 From: WeetHet Date: Thu, 3 Apr 2025 17:35:50 +0300 Subject: [PATCH 3/3] koji: install completions, check version --- pkgs/by-name/ko/koji/package.nix | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/pkgs/by-name/ko/koji/package.nix b/pkgs/by-name/ko/koji/package.nix index 414d9623131e..42f605d553c1 100644 --- a/pkgs/by-name/ko/koji/package.nix +++ b/pkgs/by-name/ko/koji/package.nix @@ -9,6 +9,8 @@ openssl, gitMinimal, writableTmpDirAsHomeHook, + installShellFiles, + versionCheckHook, }: rustPlatform.buildRustPackage (finalAttrs: { @@ -30,6 +32,7 @@ rustPlatform.buildRustPackage (finalAttrs: { nativeBuildInputs = [ pkg-config perl + installShellFiles ]; buildInputs = [ @@ -46,6 +49,17 @@ rustPlatform.buildRustPackage (finalAttrs: { 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";