Skip to content

fix(core): add /nix/store to trusted system paths for Nix package manager - #28256

Closed
Dakshx07 wants to merge 1 commit into
google-gemini:mainfrom
Dakshx07:fix/nix-store-trusted-path
Closed

fix(core): add /nix/store to trusted system paths for Nix package manager#28256
Dakshx07 wants to merge 1 commit into
google-gemini:mainfrom
Dakshx07:fix/nix-store-trusted-path

Conversation

@Dakshx07

@Dakshx07 Dakshx07 commented Jul 5, 2026

Copy link
Copy Markdown

Problem

On systems using the Nix package manager (NixOS, nix-darwin, devenv), binaries like rg (Ripgrep) are resolved to paths under /nix/store/.... However, isTrustedSystemPath() uses a hardcoded allowlist that does not include /nix/store.

This caused:

  1. rg to be rejected as untrusted
  2. Fallback to GrepTool (standard grep)
  3. Standard grep ignoring .gitignore, causing indefinite hangs on large projects with target/, node_modules/, etc.

Fixes #28251

Changes

  • packages/core/src/utils/paths.ts: Added /nix/store to trustedPrefixes in isTrustedSystemPath(), consistent with how Homebrew (/opt/homebrew, /usr/local/Cellar) is already handled.
  • packages/core/src/utils/paths.test.ts: Added tests verifying /nix/store/... paths are trusted on both linux (NixOS) and darwin (nix-darwin).

Testing

All 118 existing tests pass + 3 new Nix-specific test cases added.

…ager

Binaries managed by Nix (NixOS, nix-darwin, devenv) are installed under
/nix/store which was missing from the isTrustedSystemPath allowlist.

This caused gemini-cli to reject the resolved rg binary and fall back to
GrepTool (standard grep), which does not respect .gitignore rules. On
large projects (Rust target/ dirs, node_modules/) this caused the agent
to hang indefinitely while crawling gigabytes of untracked binary files.

Fix: add '/nix/store' to the trustedPrefixes array in the Unix branch of
isTrustedSystemPath(), matching how Homebrew (/opt/homebrew) is already
handled.

Adds unit tests covering NixOS (linux) and nix-darwin (darwin) paths.

Fixes google-gemini#28251
@Dakshx07
Dakshx07 requested a review from a team as a code owner July 5, 2026 10:26
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses an issue where binaries managed by the Nix package manager were not recognized as trusted system paths. By updating the allowlist in the core utilities, the system can now correctly identify and utilize these binaries, preventing performance degradation caused by falling back to less efficient tools.

Highlights

  • Nix Store Support: Added '/nix/store' to the trusted system path allowlist to support binaries managed by the Nix package manager.
  • Improved Tool Reliability: Ensures that tools like Ripgrep are correctly identified as trusted, preventing unnecessary fallbacks to standard grep that caused performance issues.
  • Enhanced Test Coverage: Added new unit tests to verify that Nix store paths are correctly validated on both Linux and macOS platforms.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@github-actions github-actions Bot added the size/s A small PR label Jul 5, 2026
@github-actions

github-actions Bot commented Jul 5, 2026

Copy link
Copy Markdown

📊 PR Size: size/S

  • Lines changed: 26
  • Additions: +26
  • Deletions: -0
  • Files changed: 2

@google-cla

google-cla Bot commented Jul 5, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request adds /nix/store to the list of trusted system paths on macOS and Linux in packages/core/src/utils/paths.ts, and introduces corresponding unit tests in packages/core/src/utils/paths.test.ts. There are no review comments, and I have no feedback to provide.

@gemini-cli gemini-cli Bot added priority/p2 Important but can be addressed in a future release. area/documentation Gemini CLI documentation tasks and issues labels Jul 5, 2026
@gemini-cli

gemini-cli Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Hi there! Thank you for your interest in contributing to Gemini CLI.

To ensure we maintain high code quality and focus on our prioritized roadmap, we only guarantee review and consideration of pull requests for issues that are explicitly labeled as 'help wanted'.

This PR will be closed in 7 days if it remains without that designation. We encourage you to find and contribute to existing 'help wanted' issues in our backlog! Thank you for your understanding.

@gemini-cli

gemini-cli Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

This pull request is being closed as it has been open for 14 days without a 'help wanted' designation. We encourage you to find and contribute to existing 'help wanted' issues in our backlog! Thank you for your understanding.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/documentation Gemini CLI documentation tasks and issues priority/p2 Important but can be addressed in a future release. size/s A small PR status/pr-nudge-sent

Projects

None yet

Development

Successfully merging this pull request may close these issues.

isTrustedSystemPath rejects binaries in /nix/store, causing catastrophic fallback to GrepTool

1 participant