nix-agent-wire already provides a Claude Code module. In addittion to opencode, we can add support running claude-code CLI mirroring the exact things provided for opencode.
Implementation Plan
Key Design Decisions
- Claude Code's API config is env-var-based (not a JSON config file like opencode). Based on the official Juspay
jclaude() wrapper, it needs: ANTHROPIC_AUTH_TOKEN, ANTHROPIC_BASE_URL, ANTHROPIC_MODEL, multiple model overrides, timeouts, and feature flags.
- Default model:
glm-latest (same as opencode)
- No
init variant needed (unlike opencode, claude-code doesn't use a config file for API settings)
Environment Variables (from official jclaude() wrapper)
ANTHROPIC_BASE_URL="https://grid.ai.juspay.net/"
ANTHROPIC_AUTH_TOKEN="$JUSPAY_API_KEY"
ANTHROPIC_MODEL="glm-latest"
ANTHROPIC_SMALL_FAST_MODEL="glm-latest"
CLAUDE_CODE_SUBAGENT_MODEL="glm-latest"
ANTHROPIC_DEFAULT_SONNET_MODEL="glm-latest"
ANTHROPIC_DEFAULT_OPUS_MODEL="glm-latest"
ANTHROPIC_DEFAULT_HAIKU_MODEL="glm-latest"
DISABLE_INTERLEAVED_THINKING=true
API_TIMEOUT_MS=600000
BASH_MAX_TIMEOUT_MS=300000
CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1
# Unset conflicting vars
GEMINI_API_KEY=""
GOOGLE_CLOUD_PROJECT=""
GOOGLE_APPLICATION_CREDENTIALS=""
CLAUDE_CODE_USE_VERTEX=""
CLOUD_ML_REGION=""
GOOGLE_VERTEX_PROJECT=""
ANTHROPIC_VERTEX_PROJECT_ID=""
Changes Required
New Files
claude-code/lib.nix — Shared library with API key check and Juspay env vars
claude-code/packages/oneclick.nix — Wraps claude-code binary with all Juspay env vars via makeWrapper
claude-code/modules/default.nix — Home-manager module entry point
claude-code/modules/home-manager.nix — Sets programs.claude-code.settings.env with Juspay env vars
test/home-manager-claude-code/test.nix — NixOS VM test for home-manager module
test/home-manager-claude-code/flake.nix — Test flake
doc/demo-claude-code/demo.tape — VHS tape for claude-code demo
doc/demo-claude-code/flake.nix — Demo flake
Modified Files
flake.nix — Add claude-code to overlay, packages, apps, and homeModules (claude-code, claude-code-with-skills)
opencode/packages/default.nix — Add claude-code to interactive selector menu
vira.hs — Add ./test/home-manager-claude-code to CI flakes
README.md — Document claude-code variants and home-manager modules
Verification
nix-agent-wire already provides a Claude Code module. In addittion to opencode, we can add support running claude-code CLI mirroring the exact things provided for opencode.
Implementation Plan
Key Design Decisions
jclaude()wrapper, it needs:ANTHROPIC_AUTH_TOKEN,ANTHROPIC_BASE_URL,ANTHROPIC_MODEL, multiple model overrides, timeouts, and feature flags.glm-latest(same as opencode)initvariant needed (unlike opencode, claude-code doesn't use a config file for API settings)Environment Variables (from official
jclaude()wrapper)Changes Required
New Files
claude-code/lib.nix— Shared library with API key check and Juspay env varsclaude-code/packages/oneclick.nix— Wrapsclaude-codebinary with all Juspay env vars viamakeWrapperclaude-code/modules/default.nix— Home-manager module entry pointclaude-code/modules/home-manager.nix— Setsprograms.claude-code.settings.envwith Juspay env varstest/home-manager-claude-code/test.nix— NixOS VM test for home-manager moduletest/home-manager-claude-code/flake.nix— Test flakedoc/demo-claude-code/demo.tape— VHS tape for claude-code demodoc/demo-claude-code/flake.nix— Demo flakeModified Files
flake.nix— Addclaude-codeto overlay, packages, apps, and homeModules (claude-code,claude-code-with-skills)opencode/packages/default.nix— Add claude-code to interactive selector menuvira.hs— Add./test/home-manager-claude-codeto CI flakesREADME.md— Document claude-code variants and home-manager modulesVerification
nix run . -- --version— default package buildsnix build .#claude-code-oneclick— claude-code oneclick buildsnix run .#claude-code-oneclickwithoutJUSPAY_API_KEYshows errornix run .shows updated selector with claude-code optionvira ci -b— all NixOS VM tests pass