{ lib, buildNpmPackage, fetchzip, nodejs_20, }: buildNpmPackage rec { pname = "claude-code"; version = "1.0.111"; nodejs = nodejs_20; # required for sandboxed Nix builds on Darwin src = fetchzip { url = "https://registry.npmjs.org/@anthropic-ai/claude-code/-/claude-code-${version}.tgz"; hash = "sha256-yA+ttxG2KH2WFeMI0YzVqgbs4kblZRkpw/owpdIqH1E="; }; npmDepsHash = "sha256-jpvy7b4A+E5iI7Y7kYnwH51BZAQGVXKaf3lQjI9e3OM="; postPatch = '' cp ${./package-lock.json} package-lock.json ''; dontNpmBuild = true; AUTHORIZED = "1"; # `claude-code` tries to auto-update by default, this disables that functionality. # https://docs.anthropic.com/en/docs/agents-and-tools/claude-code/overview#environment-variables # The DEV=true env var causes claude to crash with `TypeError: window.WebSocket is not a constructor` postInstall = '' wrapProgram $out/bin/claude \ --set DISABLE_AUTOUPDATER 1 \ --unset DEV ''; passthru.updateScript = ./update.sh; meta = { description = "Agentic coding tool that lives in your terminal, understands your codebase, and helps you code faster"; homepage = "https://github.com/anthropics/claude-code"; downloadPage = "https://www.npmjs.com/package/@anthropic-ai/claude-code"; license = lib.licenses.unfree; maintainers = with lib.maintainers; [ malo markus1189 omarjatoi ]; mainProgram = "claude"; }; }