gemini-cli-bin: add installCheckPhase

The original check on `gemini mcp list` output was simplified
as suggested by the co-author to check the `gemini -v` exit code instead.

Co-authored-by: ljxfstorm <ljxf.storm@live.cn>
This commit is contained in:
Kenichi Kamiya
2025-09-28 15:26:16 +09:00
co-authored by ljxfstorm
parent 26e1e9e886
commit 5dc74ce569
@@ -3,6 +3,7 @@
stdenvNoCC,
fetchurl,
nodejs,
writableTmpDirAsHomeHook,
nix-update-script,
}:
stdenvNoCC.mkDerivation (finalAttrs: {
@@ -17,6 +18,7 @@ stdenvNoCC.mkDerivation (finalAttrs: {
phases = [
"installPhase"
"fixupPhase"
"installCheckPhase"
];
strictDeps = true;
@@ -31,6 +33,19 @@ stdenvNoCC.mkDerivation (finalAttrs: {
runHook postInstall
'';
doInstallCheck = true;
nativeInstallCheckInputs = [
writableTmpDirAsHomeHook
];
# versionCheckHook cannot be used because the reported version might be incorrect (e.g., 0.6.1 returns 0.6.0).
installCheckPhase = ''
runHook preInstallCheck
"$out/bin/gemini" -v
runHook postInstallCheck
'';
passthru.updateScript = nix-update-script {
# Ignore `preview` and `nightly` tags
extraArgs = [ "--version-regex=^v([0-9.]+)$" ];