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,
installShellFiles,
stdenv,
versionCheckHook,
}:
buildGoModule (finalAttrs: {
pname = "geminicommit";
version = "0.4.0";
version = "0.4.1";
src = fetchFromGitHub {
owner = "tfkhdyt";
repo = "geminicommit";
tag = "v${finalAttrs.version}";
hash = "sha256-hJevJkniyICUUr1UyS0A5SKuuYRU0dGHMWzF99Yr2Eo=";
hash = "sha256-QUI5JI1udOo3IOXegoes3pwwgSfxXIjxXIPsA5SuAJo=";
};
vendorHash = "sha256-IfqlPg+HPcOfjlwwuLi2/R21UD83xQzWyUmzM7JSDEs=";
vendorHash = "sha256-AFm+1RQ6sMSe+kY/cw1Ly/8WEj2/yk0nJQiEJzV6jKg=";
nativeBuildInputs = [
installShellFiles
@ -26,9 +27,18 @@ buildGoModule (finalAttrs: {
postInstall =
let
cmd = finalAttrs.meta.mainProgram;
goDefaultCmd = finalAttrs.pname;
in
lib.optionalString (with stdenv; buildPlatform.canExecute hostPlatform) ''
# `geminicommit` requires write permissions to $HOME for its `config.toml`
# The official github released binary is renamed since v0.4.1,
# 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
export HOME=$(mktemp -d)
@ -39,11 +49,17 @@ buildGoModule (finalAttrs: {
done
'';
nativeInstallCheckInputs = [
versionCheckHook
];
doInstallCheck = true;
meta = {
description = "CLI that generates git commit messages with Google Gemini AI";
homepage = "https://github.com/tfkhdyt/geminicommit";
license = lib.licenses.gpl3Only;
maintainers = with lib.maintainers; [ bryango ];
mainProgram = "geminicommit";
mainProgram = "gmc";
};
})