-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Description
Description
When using Claude Code's agent teams feature on NixOS, the teammate spawning mechanism
downloads and installs a standard (unpatched) Linux binary into ~/.local/bin/ and
~/.local/share/. This binary is incompatible with NixOS because NixOS does not follow
the Filesystem Hierarchy Standard (FHS) — there is no /lib64/ld-linux-x86-64.so.2
dynamic linker, and system libraries are not at standard paths.
The teammate process fails to start. Worse, the incompatible binary in ~/.local/bin/
can shadow the working Nix-managed binary in PATH, preventing Claude Code itself from
starting until the user manually removes the files from ~/.local/.
Environment
- OS: NixOS
- Claude Code version: 2.1.39
- Installation method: Nix flake using ryoppippi/claude-code-overlay, which patches the binary with
autoPatchelfHook - Feature flag:
CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1
Steps to reproduce
- Install Claude Code on NixOS using the Nix overlay (patches the ELF binary for NixOS)
- Enable agent teams:
CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1 - Use
TeamCreateorTasktool to spawn a teammate - Teammate fails — an unpatched binary is installed to
~/.local/bin/and~/.local/share/ - Claude Code itself may fail to start afterward (the unpatched
~/.local/bin/claudeshadows the Nix-managed one)
Expected behavior
Teammate processes should reuse the same Claude Code binary that the lead process is
running. No additional binary should be downloaded or installed into the user's home
directory.
Actual behavior
The teammate spawning mechanism downloads a standard Linux binary to ~/.local/bin/
and ~/.local/share/. On NixOS this binary cannot execute (missing dynamic linker).
The only recovery is to manually rm the files from ~/.local/.
Workaround
After the failure, manually remove the incompatible files:
rm -rf ~/.local/bin/claude ~/.local/share/claude*Then Claude Code starts normally again using the Nix-managed binary.
Analysis
The Nix overlay properly handles the primary Claude Code binary:
autoPatchelfHookpatches the ELF interpreter and RPATH to use Nix store pathswrapProgramsetsDISABLE_AUTOUPDATER=1andDISABLE_INSTALLATION_CHECKS=1
The primary binary works correctly. The issue occurs specifically when agent teams are
used — some code path installs a fresh, unpatched binary to ~/.local/ despite
the DISABLE_* flags being set. Since Claude Code is closed source, the exact internal
mechanism that triggers this installation is not known.
Request
The teammate spawning flow should not install a new binary when a working claude is
already available in PATH. On NixOS (and other non-FHS distributions like Guix), any
binary downloaded for standard Linux will fail to execute due to missing dynamic linker
and libraries.
Ideally, the DISABLE_AUTOUPDATER and DISABLE_INSTALLATION_CHECKS flags should be
respected across all code paths, including teammate spawning — or an override mechanism
(e.g., an environment variable like CLAUDE_CODE_BINARY) should be provided so
package managers can control which binary is used.