geminicommit: 0.4.0 -> 0.4.1, fix mainProgram (#415239)

This commit is contained in:
Aleksana 2025-06-10 01:35:16 +08:00 committed by GitHub
commit 46c0fc211f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -4,20 +4,21 @@
fetchFromGitHub, fetchFromGitHub,
installShellFiles, installShellFiles,
stdenv, stdenv,
versionCheckHook,
}: }:
buildGoModule (finalAttrs: { buildGoModule (finalAttrs: {
pname = "geminicommit"; pname = "geminicommit";
version = "0.4.0"; version = "0.4.1";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "tfkhdyt"; owner = "tfkhdyt";
repo = "geminicommit"; repo = "geminicommit";
tag = "v${finalAttrs.version}"; tag = "v${finalAttrs.version}";
hash = "sha256-hJevJkniyICUUr1UyS0A5SKuuYRU0dGHMWzF99Yr2Eo="; hash = "sha256-QUI5JI1udOo3IOXegoes3pwwgSfxXIjxXIPsA5SuAJo=";
}; };
vendorHash = "sha256-IfqlPg+HPcOfjlwwuLi2/R21UD83xQzWyUmzM7JSDEs="; vendorHash = "sha256-AFm+1RQ6sMSe+kY/cw1Ly/8WEj2/yk0nJQiEJzV6jKg=";
nativeBuildInputs = [ nativeBuildInputs = [
installShellFiles installShellFiles
@ -26,9 +27,18 @@ buildGoModule (finalAttrs: {
postInstall = postInstall =
let let
cmd = finalAttrs.meta.mainProgram; cmd = finalAttrs.meta.mainProgram;
goDefaultCmd = finalAttrs.pname;
in in
lib.optionalString (with stdenv; buildPlatform.canExecute hostPlatform) '' # The official github released binary is renamed since v0.4.1,
# `geminicommit` requires write permissions to $HOME for its `config.toml` # see: https://github.com/tfkhdyt/geminicommit/releases/tag/v0.4.1
# Here we link the old name (which is also the `go build` default name)
# for backward compatibility:
''
mv $out/bin/${goDefaultCmd} $out/bin/${cmd}
ln -s $out/bin/${cmd} $out/bin/${goDefaultCmd}
''
+ lib.optionalString (with stdenv; buildPlatform.canExecute hostPlatform) ''
# `gmc` requires write permissions to $HOME for its `config.toml`
# ... which is automatically initiated on startup # ... which is automatically initiated on startup
export HOME=$(mktemp -d) export HOME=$(mktemp -d)
@ -39,11 +49,17 @@ buildGoModule (finalAttrs: {
done done
''; '';
nativeInstallCheckInputs = [
versionCheckHook
];
doInstallCheck = true;
meta = { meta = {
description = "CLI that generates git commit messages with Google Gemini AI"; description = "CLI that generates git commit messages with Google Gemini AI";
homepage = "https://github.com/tfkhdyt/geminicommit"; homepage = "https://github.com/tfkhdyt/geminicommit";
license = lib.licenses.gpl3Only; license = lib.licenses.gpl3Only;
maintainers = with lib.maintainers; [ bryango ]; maintainers = with lib.maintainers; [ bryango ];
mainProgram = "geminicommit"; mainProgram = "gmc";
}; };
}) })