Skip to content

gemini-cli: build bundle, 0.30.0 -> 0.31.0#493475

Merged
Aleksanaa merged 2 commits intoNixOS:masterfrom
matshch:gemini-cli-package
Mar 10, 2026
Merged

gemini-cli: build bundle, 0.30.0 -> 0.31.0#493475
Aleksanaa merged 2 commits intoNixOS:masterfrom
matshch:gemini-cli-package

Conversation

@matshch
Copy link
Copy Markdown
Contributor

@matshch matshch commented Feb 23, 2026

This decreases output path size 15 times and makes package layout a lot closer to gemini-cli-bin.

Also includes update to 0.31.0, as it requires some changes in the build process as well:

Things done

  • Built on platform:
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • Tested, as applicable:
  • Ran nixpkgs-review on this PR. See nixpkgs-review usage.
  • Tested basic functionality of all binary files, usually in ./result/bin/.
  • Nixpkgs Release Notes
    • Package update: when the change is major or breaking.
  • NixOS Release Notes
    • Module addition: when adding a new NixOS module.
    • Module update: when the change is significant.
  • Fits CONTRIBUTING.md, pkgs/README.md, maintainers/README.md and other READMEs.

@matshch
Copy link
Copy Markdown
Contributor Author

matshch commented Feb 23, 2026

@pedrobrantes @xiaoxiangmoe @FlameFlag @taranarmo what do you think about this change? Is there any reason to bring the whole node_modules tree when there exists a convenient way to package everything into one file?

@nixpkgs-ci nixpkgs-ci bot added 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. labels Feb 23, 2026
@taranarmo
Copy link
Copy Markdown
Contributor

I am okay with the change as soon as the package works, though my knowledge in Node and JS is not sufficient to answer the rest 😅

@xiaoxiangmoe
Copy link
Copy Markdown
Member

xiaoxiangmoe commented Feb 24, 2026

If you use cp -r bundle $out/share/gemini-cli, does it correctly handle the native dependency requirements in node_modules? Such as node-pty, keytar and so on.

@xiaoxiangmoe
Copy link
Copy Markdown
Member

I had considered switching to a build bundle, but ultimately decided to keep the current implementation that includes node_modules for the following reasons:

  • Switching to build bundles would require special handling of npm dependencies related to node addons. It looks a little troublesome. I haven't debugged it in detail yet.
  • There needs to be an implementation that aligns with the implementation of npm install @google/gemini-cli. Fortunately, this version without bundles seems to behave consistently with npm install @google/gemini-cli and npx @google/gemini-cli.

@ljxfstorm
Copy link
Copy Markdown
Contributor

Should we consider introducing this as a variant rather than a full replacement?

Additionally, we could then deprecate gemini-cli-bin to streamline maintenance going forward.

Historically, we introduced the -bin package because upstream builds were unstable and it offered a much smaller size. Now that upstream has stabilized and the bundle variant addresses the output size issue, maintaining both packages feels redundant.

The only trade-off is the build-time overhead: unless the bundle variant is cached, users will need to perform a full source build, which is much heavier than simply fetching the pre-built -bin.
Do we have a way to confirm whether the bundle build will be included in the Hydra cache?

@matshch
Copy link
Copy Markdown
Contributor Author

matshch commented Feb 25, 2026

I have checked and indeed there are some differences in behavior:

  • The most noticeable one is that the gemini-cli from master supports interactive shell commands (due to node-pty presence), and both gemini-cli-bin and gemini-cli from this PR do not.
  • It looks like gemini-cli from master should also utilize system keychain for API key storage, but it does not work for me for some reason.

I'm just disappointed that we have to bring such a big closure when we only need like 5% of that.

@matshch
Copy link
Copy Markdown
Contributor Author

matshch commented Feb 25, 2026

I think I've cracked it:

I've also fixed keytar cleanup so that saving API key to the system keychain actually works now!

@matshch matshch marked this pull request as ready for review February 25, 2026 23:08
@matshch
Copy link
Copy Markdown
Contributor Author

matshch commented Feb 25, 2026

nixpkgs-review result

Generated using nixpkgs-review.

Command: nixpkgs-review pr 493475
Commit: 15f1b7e619537a8fd452e2fa2cef12cddea502d0


x86_64-linux

✅ 2 packages built:
  • gemini-cli
  • vscode-extensions.Google.gemini-cli-vscode-ide-companion

aarch64-linux

✅ 2 packages built:
  • gemini-cli
  • vscode-extensions.Google.gemini-cli-vscode-ide-companion

x86_64-darwin

✅ 2 packages built:
  • gemini-cli
  • vscode-extensions.Google.gemini-cli-vscode-ide-companion

aarch64-darwin

✅ 2 packages built:
  • gemini-cli
  • vscode-extensions.Google.gemini-cli-vscode-ide-companion

Copy link
Copy Markdown
Member

@FlameFlag FlameFlag left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome work, LGTM!

@FlameFlag
Copy link
Copy Markdown
Member

nixpkgs-review result

Generated using nixpkgs-review-gha

Command: nixpkgs-review pr 493475
Commit: 15f1b7e619537a8fd452e2fa2cef12cddea502d0 (subsequent changes)
Merge: a89a1f0c9af4fd0b57abb96e13746713fac54dc2

Logs: https://github.com/FlameFlag/nixpkgs-review-gha/actions/runs/22421838617


x86_64-linux

✅ 2 packages built:
  • gemini-cli
  • vscode-extensions.Google.gemini-cli-vscode-ide-companion

aarch64-linux

✅ 2 packages built:
  • gemini-cli
  • vscode-extensions.Google.gemini-cli-vscode-ide-companion

x86_64-darwin (sandbox = relaxed)

✅ 2 packages built:
  • gemini-cli
  • vscode-extensions.Google.gemini-cli-vscode-ide-companion

aarch64-darwin (sandbox = relaxed)

✅ 2 packages built:
  • gemini-cli
  • vscode-extensions.Google.gemini-cli-vscode-ide-companion

@nixpkgs-ci nixpkgs-ci bot added 12.approvals: 1 This PR was reviewed and approved by one person. 12.approved-by: package-maintainer This PR was reviewed and approved by a maintainer listed in any of the changed packages. labels Feb 26, 2026
@jtliang24 jtliang24 mentioned this pull request Feb 28, 2026
13 tasks
@nixpkgs-ci nixpkgs-ci bot added the 2.status: merge conflict This PR has merge conflicts with the target branch label Mar 2, 2026
@ljxfstorm
Copy link
Copy Markdown
Contributor

Upstream PR google-gemini/gemini-cli#20154 modified the shebang in gemini.js (v0.31.0), which patchShebangs cannot handle correctly.
I've introduced makeWrapper in #495738 to resolve this for gemini-cli-bin.
I'm concerned this might also impact the bundle build.

matshch added 2 commits March 3, 2026 11:32
This decreases output path size 15 times and makes package layout
a lot closer to gemini-cli-bin, while saving all the features of
the native installation.
@matshch matshch force-pushed the gemini-cli-package branch from 15f1b7e to d5725f9 Compare March 3, 2026 18:13
@matshch
Copy link
Copy Markdown
Contributor Author

matshch commented Mar 3, 2026

@ljxfstorm, thanks for the notice, I've pushed an update that incorporates your solution from #495738.

@nixpkgs-ci nixpkgs-ci bot removed the 2.status: merge conflict This PR has merge conflicts with the target branch label Mar 3, 2026
@nixpkgs-ci nixpkgs-ci bot added the 8.has: package (update) This PR updates a package to a newer version label Mar 3, 2026
@matshch
Copy link
Copy Markdown
Contributor Author

matshch commented Mar 3, 2026

nixpkgs-review result

Generated using nixpkgs-review.

Command: nixpkgs-review pr 493475
Commit: d5725f96cf8f30d7589a9264ffd56eea820514ff


x86_64-linux

✅ 2 packages built:
  • gemini-cli
  • vscode-extensions.Google.gemini-cli-vscode-ide-companion

aarch64-linux

✅ 2 packages built:
  • gemini-cli
  • vscode-extensions.Google.gemini-cli-vscode-ide-companion

x86_64-darwin

✅ 2 packages built:
  • gemini-cli
  • vscode-extensions.Google.gemini-cli-vscode-ide-companion

aarch64-darwin

✅ 2 packages built:
  • gemini-cli
  • vscode-extensions.Google.gemini-cli-vscode-ide-companion

@matshch matshch changed the title gemini-cli: build bundle gemini-cli: build bundle, 0.30.0 -> 0.31.0 Mar 3, 2026
@Aleksanaa Aleksanaa added this pull request to the merge queue Mar 10, 2026
Merged via the queue into NixOS:master with commit 54a9d10 Mar 10, 2026
32 of 34 checks passed
@matshch matshch deleted the gemini-cli-package branch March 10, 2026 21:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

8.has: package (update) This PR updates a package to a newer version 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 12.approvals: 1 This PR was reviewed and approved by one person. 12.approved-by: package-maintainer This PR was reviewed and approved by a maintainer listed in any of the changed packages.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants