Nix flake for Gemini CLI - Google's open-source AI agent for your terminal.
- Official distribution: Uses the bundled JS from Google's releases with Node.js 22
- Always up-to-date: Hourly automated updates via GitHub Actions
- Sandbox-compatible: No network access during build
- Binary caching: Fast installs via Cachix (optional)
- Version pinning: Pin to specific versions, major versions, or latest
nix run github:sadjow/gemini-cli-nixnix profile install github:sadjow/gemini-cli-nix{
inputs.gemini-cli-nix.url = "github:sadjow/gemini-cli-nix";
# In your home configuration:
home.packages = [ inputs.gemini-cli-nix.packages.${system}.default ];
}{
inputs.gemini-cli-nix.url = "github:sadjow/gemini-cli-nix";
# In your system configuration:
environment.systemPackages = [ inputs.gemini-cli-nix.packages.${system}.default ];
}nix run github:sadjow/gemini-cli-nixnix run github:sadjow/gemini-cli-nix?ref=v0.26.0nix run github:sadjow/gemini-cli-nix?ref=v0{
inputs = {
# Always latest (auto-updates)
gemini-cli.url = "github:sadjow/gemini-cli-nix";
# Pin to exact version
gemini-cli.url = "github:sadjow/gemini-cli-nix?ref=v0.26.0";
# Track major version (stays on v0.x)
gemini-cli.url = "github:sadjow/gemini-cli-nix?ref=v0";
};
}You can customize the binary name when building:
pkgs.gemini-cli.override { binName = "gem"; }| Parameter | Default | Description |
|---|---|---|
binName |
gemini |
Binary name for the CLI |
disableTelemetry |
false |
Disable telemetry when true |
pkgs.gemini-cli.override { disableTelemetry = true; }For faster installs without building from source:
cachix use gemini-cli-nixOr add to your Nix configuration:
{
nix.settings = {
substituters = [ "https://gemini-cli-nix.cachix.org" ];
trusted-public-keys = [ "gemini-cli-nix.cachix.org-1:DzAIhrYktyRtR1OO0KjyYEKR5hjwsdZU2NwHlEBCcvI=" ];
};
}Gemini CLI may show update notifications even when installed via Nix. To disable:
- Run
/settingsin Gemini CLI - Navigate to General settings
- Disable "Auto Update Notifications"
Or add to ~/.gemini/settings.json:
{
"general": {
"enableAutoUpdateNotification": false
}
}If gemini command is not found:
# Check if nix-profile/bin is in PATH
echo $PATH | tr ':' '\n' | grep nix-profile
# Add to ~/.bashrc or ~/.zshrc
export PATH="$HOME/.nix-profile/bin:$PATH"On macOS, create a stable symlink to avoid re-granting permissions after updates:
mkdir -p ~/.local/bin
ln -sf $(which gemini) ~/.local/bin/gemini
# Add ~/.local/bin to PATH| Feature | npm global | Homebrew | This Flake |
|---|---|---|---|
| Official Runtime | Yes | Yes | Yes |
| Latest Version | Manual | Delayed | Hourly checks |
| Survives Node Switch | Lost on switch | Always available | Always available |
| Binary Cache | None | Bottles | Cachix |
| Declarative Config | No | Limited | Yes |
| Version Pinning | Manual | Formula version | Git tags |
| Reproducible | No | Mostly | Yes |
| Sandbox Builds | N/A | N/A | Yes |
nix build
./result/bin/gemini --version./scripts/update-version.sh./scripts/update-version.sh --checkgemini-cli-nix/
├── flake.nix # Nix flake definition
├── package.nix # Package derivation
├── scripts/
│ ├── update-version.sh # Version updater
│ └── setup-github-permissions.sh
└── .github/workflows/
├── update-gemini-cli.yml # Hourly updates
├── build.yml # CI builds
├── test-pr.yml # PR validation
└── create-version-tag.yml # Auto-tagging
This package builds Gemini CLI from the upstream tagged source and npm lockfile with Nix's buildNpmPackage, then runs the packaged CLI with Node.js 22. The derivation materializes the workspace runtime dependency on @google/gemini-cli-core, which makes the package robust against upstream release artifact layout changes.
The wrapper script sets:
GEMINI_TELEMETRY_ENABLED=false- Only whendisableTelemetry = true
- Nix with flakes enabled
This Nix packaging is MIT licensed.
Gemini CLI itself is Apache 2.0 licensed by Google.