[BUG] Claude Code not inheriting NixOS Paths

Resolved 💬 3 comments Opened Jul 13, 2025 by AnthonyRonning Closed Jul 16, 2025
  • Platform (select one):
  • Anthropic API
  • Claude CLI version: 1.0.51 (Claude Code)
  • Operating System: NixOS 24.05 (Uakari) on aarch64
  • Terminal: screen (running in OrbStack VM on macOS)

Bug Description

Claude Code fails to properly inherit PATH and environment variables from a nix develop shell, preventing access to development tools defined in the project's flake.nix. This is a regression - this functionality has worked correctly for a
long time.

Steps to Reproduce

  1. Create a NixOS project with a flake.nix that includes development tools (e.g., bun)
  2. Run nix develop to enter the development shell
  3. Verify tools are available: which bun (shows the tool is available)
  4. Run claude from within the nix develop shell
  5. Use Claude's Bash tool to check for the same tools: which bun

Expected Behavior

Claude Code should inherit the complete environment from the parent shell, including:

  • All PATH modifications made by nix develop
  • Access to all development tools defined in the flake
  • The $IN_NIX_SHELL environment variable is properly set (which it is)

Actual Behavior

  • Claude Code sees $IN_NIX_SHELL=impure (correctly identifying it's in a nix shell)
  • However, PATH does not include the nix develop environment's additions
  • Development tools like bun that are available in the parent shell are not accessible to Claude
  • The PATH only contains system-wide paths, missing the development shell paths

Additional Context

PATH in nix develop shell (outside Claude):
/nix/store/12pmq4z1c04jpd322cjqvla0900c9s26-bun-1.2.2/bin:/nix/store/c81p578r4qgcxpd1v8iy0g1zpp5zvala-just-1.39.0/bin:/nix/store/vwpm32inl7g5w4p1hqkhjlj1wv0ic67y-jq-1.7.1-bin/bin:/nix/store/iq72p1ffpi5k94sdl3hyiqm4fdmw2pb5-rust-default-1.
78.0/bin:[... many more nix store paths ...]

PATH inside Claude (missing all the development tools):
/nix/store/rjzxrkll5pwd5j1nyww710b25n319dgs-patchelf-0.15.0/bin:[... only system paths, no development tools ...]

Key missing paths include:

  • /nix/store/12pmq4z1c04jpd322cjqvla0900c9s26-bun-1.2.2/bin (bun)
  • /nix/store/c81p578r4qgcxpd1v8iy0g1zpp5zvala-just-1.39.0/bin (just)
  • /nix/store/iq72p1ffpi5k94sdl3hyiqm4fdmw2pb5-rust-default-1.78.0/bin (rust toolchain)
  • And many other development dependencies

This appears to be an environment inheritance issue where Claude Code is not properly capturing the modified PATH from the parent nix develop shell. The nix shell sets up a carefully crafted environment with specific tool versions, and
Claude should have access to this same environment.

The fact that $IN_NIX_SHELL=impure is correctly set indicates that some environment variables are being inherited, but the critical PATH variable is being reset or filtered somehow.

This has worked perfectly since launch. Now an update within the last few days broke shell paths and now I'm unable to work. I use claude code exclusively and without access to tools, it is useless to me. Please fix or I'll have to cancel my subscription.

Update:

I tried every version from 1.0.51 to 1.0.45 and 1.0.45 finally got it to work. So something in 1.0.46 broke.

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗