Loading pkgs/by-name/ge/gemini-cli-bin/package.nix +39 −24 Original line number Diff line number Diff line { lib, stdenvNoCC, fetchurl, fetchzip, nodejs, sysctl, writableTmpDirAsHomeHook, Loading @@ -11,15 +11,14 @@ }: stdenvNoCC.mkDerivation (finalAttrs: { pname = "gemini-cli-bin"; version = "0.34.0"; version = "0.36.0"; src = fetchurl { url = "https://github.com/google-gemini/gemini-cli/releases/download/v${finalAttrs.version}/gemini.js"; hash = "sha256-Qfol6zATjVK6d4gfA6ql3aVwjqRE7NAYqg5YTyEVDHk="; src = fetchzip { url = "https://github.com/google-gemini/gemini-cli/releases/download/v${finalAttrs.version}/gemini-cli-bundle.zip"; hash = "sha256-wu+QZ5roBNY1mwtte+7opKFBRdOCXONW95UEJ7M3gJI="; stripRoot = false; }; dontUnpack = true; strictDeps = true; nativeBuildInputs = [ Loading @@ -31,24 +30,41 @@ stdenvNoCC.mkDerivation (finalAttrs: { ripgrep ]; installPhase = '' runHook preInstall patchPhase = '' runHook prePatch local dest="$out/lib/gemini/gemini.js" install -Dm644 "$src" "$dest" # chunk filenames contain unpredictable hashes, use glob to iterate for chunk in ./chunk-*.js; do # disable auto-update sed -i '/enableAutoUpdate: {/,/}/ s/default: true/default: false/' "$dest" if grep -q 'enableAutoUpdate: {' "$chunk"; then sed -i '/enableAutoUpdate: {/,/}/ s/default: true/default: false/' "$chunk" fi # use `ripgrep` from `nixpkgs`, more dependencies but prevent downloading incompatible binary on NixOS # this workaround can be removed once the following upstream issue is resolved: # https://github.com/google-gemini/gemini-cli/issues/11438 substituteInPlace "$dest" \ if grep -q 'await resolveExistingRgPath();' "$chunk"; then substituteInPlace "$chunk" \ --replace-fail 'const existingPath = await resolveExistingRgPath();' 'const existingPath = "${lib.getExe ripgrep}";' fi done runHook postPatch ''; installPhase = '' runHook preInstall local bundleDir="$out/lib/gemini" mkdir -p "$bundleDir" cp -aT . "$bundleDir" makeWrapper "${lib.getExe nodejs}" "$out/bin/gemini" \ --add-flags "--no-warnings=DEP0040" \ --add-flags "$dest" --add-flags "$bundleDir/gemini.js" runHook postInstall ''; Loading @@ -60,19 +76,18 @@ stdenvNoCC.mkDerivation (finalAttrs: { ++ lib.optionals (with stdenvNoCC.hostPlatform; isDarwin && isx86_64) [ sysctl ]; # versionCheckHook cannot be used because the reported version might be incorrect (e.g., 0.6.1 returns 0.6.0). # versionCheckHook cannot be used because it assumes the executable is hermetic, # but we need `nativeInstallCheckInputs` installCheckPhase = '' runHook preInstallCheck "$out/bin/gemini" -v "$out/bin/gemini" -v | grep "${finalAttrs.version}" runHook postInstallCheck ''; passthru.updateScript = nix-update-script { # Ignore `preview` and `nightly` tags extraArgs = [ "--version-regex=^v([0-9.]+)$" ]; }; passthru.updateScript = nix-update-script { }; meta = { description = "AI agent that brings the power of Gemini directly into your terminal"; Loading Loading
pkgs/by-name/ge/gemini-cli-bin/package.nix +39 −24 Original line number Diff line number Diff line { lib, stdenvNoCC, fetchurl, fetchzip, nodejs, sysctl, writableTmpDirAsHomeHook, Loading @@ -11,15 +11,14 @@ }: stdenvNoCC.mkDerivation (finalAttrs: { pname = "gemini-cli-bin"; version = "0.34.0"; version = "0.36.0"; src = fetchurl { url = "https://github.com/google-gemini/gemini-cli/releases/download/v${finalAttrs.version}/gemini.js"; hash = "sha256-Qfol6zATjVK6d4gfA6ql3aVwjqRE7NAYqg5YTyEVDHk="; src = fetchzip { url = "https://github.com/google-gemini/gemini-cli/releases/download/v${finalAttrs.version}/gemini-cli-bundle.zip"; hash = "sha256-wu+QZ5roBNY1mwtte+7opKFBRdOCXONW95UEJ7M3gJI="; stripRoot = false; }; dontUnpack = true; strictDeps = true; nativeBuildInputs = [ Loading @@ -31,24 +30,41 @@ stdenvNoCC.mkDerivation (finalAttrs: { ripgrep ]; installPhase = '' runHook preInstall patchPhase = '' runHook prePatch local dest="$out/lib/gemini/gemini.js" install -Dm644 "$src" "$dest" # chunk filenames contain unpredictable hashes, use glob to iterate for chunk in ./chunk-*.js; do # disable auto-update sed -i '/enableAutoUpdate: {/,/}/ s/default: true/default: false/' "$dest" if grep -q 'enableAutoUpdate: {' "$chunk"; then sed -i '/enableAutoUpdate: {/,/}/ s/default: true/default: false/' "$chunk" fi # use `ripgrep` from `nixpkgs`, more dependencies but prevent downloading incompatible binary on NixOS # this workaround can be removed once the following upstream issue is resolved: # https://github.com/google-gemini/gemini-cli/issues/11438 substituteInPlace "$dest" \ if grep -q 'await resolveExistingRgPath();' "$chunk"; then substituteInPlace "$chunk" \ --replace-fail 'const existingPath = await resolveExistingRgPath();' 'const existingPath = "${lib.getExe ripgrep}";' fi done runHook postPatch ''; installPhase = '' runHook preInstall local bundleDir="$out/lib/gemini" mkdir -p "$bundleDir" cp -aT . "$bundleDir" makeWrapper "${lib.getExe nodejs}" "$out/bin/gemini" \ --add-flags "--no-warnings=DEP0040" \ --add-flags "$dest" --add-flags "$bundleDir/gemini.js" runHook postInstall ''; Loading @@ -60,19 +76,18 @@ stdenvNoCC.mkDerivation (finalAttrs: { ++ lib.optionals (with stdenvNoCC.hostPlatform; isDarwin && isx86_64) [ sysctl ]; # versionCheckHook cannot be used because the reported version might be incorrect (e.g., 0.6.1 returns 0.6.0). # versionCheckHook cannot be used because it assumes the executable is hermetic, # but we need `nativeInstallCheckInputs` installCheckPhase = '' runHook preInstallCheck "$out/bin/gemini" -v "$out/bin/gemini" -v | grep "${finalAttrs.version}" runHook postInstallCheck ''; passthru.updateScript = nix-update-script { # Ignore `preview` and `nightly` tags extraArgs = [ "--version-regex=^v([0-9.]+)$" ]; }; passthru.updateScript = nix-update-script { }; meta = { description = "AI agent that brings the power of Gemini directly into your terminal"; Loading