Skip to content

Add Claude Code support #22

Description

@srid

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 run . -- --version — default package builds
  • nix build .#claude-code-oneclick — claude-code oneclick builds
  • nix run .#claude-code-oneclick without JUSPAY_API_KEY shows error
  • nix run . shows updated selector with claude-code option
  • vira ci -b — all NixOS VM tests pass

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions