Gemini CLI Feature Integration¶
The Gemini CLI is now available as a configurable feature across all hosts in this NixOS flake.
Usage¶
Enable for a specific host¶
In your host configuration (e.g., hosts/p620/configuration.nix):
Available Options¶
The programs.gemini-cli module provides these configuration options:
programs.gemini-cli = {
enable = true; # Enable/disable the service
package = pkgs.gemini-cli; # Override the package if needed
environmentVariables = {
GEMINI_API_KEY = "your-api-key";
GEMINI_MODEL = "gemini-2.5-pro";
};
enableShellIntegration = true; # Adds shell aliases and desktop entry
};
Environment Variables¶
You can configure environment variables for authentication and default settings:
features = {
ai = {
enable = true;
gemini-cli = true;
};
};
# Additional configuration
programs.gemini-cli = {
environmentVariables = {
GEMINI_API_KEY = "your-api-key-here";
GEMINI_MODEL = "gemini-2.5-pro";
};
};
Shell Aliases¶
When enableShellIntegration = true (default), these aliases are available:
gemini- Run the Gemini CLIai- Convenient shortcut forgemini
Desktop Integration¶
A desktop entry is automatically created at /etc/applications/gemini-cli.desktop for GUI environments.
Examples¶
Enable on all development hosts¶
# In hosts/p620/configuration.nix
features.ai.gemini-cli = true;
# In hosts/razer/configuration.nix
features.ai.gemini-cli = true;
# In hosts/p510/configuration.nix
features.ai.gemini-cli = true;
Disable for server hosts¶
Authentication¶
The Gemini CLI supports multiple authentication methods:
- API Key: Set
GEMINI_API_KEYenvironment variable - OAuth: Interactive Google account login
- Workspace: Google Workspace account login
See the official documentation for detailed authentication setup.
Commands¶
Once installed, you can use:
# Check version
gemini --version
# Get help
gemini --help
# Start interactive session
gemini
# Use specific model
gemini -m gemini-2.5-pro
# Run in sandbox mode
gemini -s
# Debug mode
gemini -d
Module Location¶
- Feature definition:
modules/common/features.nix - Feature implementation:
modules/common/features-impl.nix - Module definition:
modules/ai/gemini-cli.nix - Package:
pkgs/gemini-cli/default.nix