Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ 2 lib, 3 buildNpmPackage, 4 fetchzip, 5 nodejs_20, 6}: 7 8buildNpmPackage rec { 9 pname = "claude-code"; 10 version = "1.0.65"; 11 12 nodejs = nodejs_20; # required for sandboxed Nix builds on Darwin 13 14 src = fetchzip { 15 url = "https://registry.npmjs.org/@anthropic-ai/claude-code/-/claude-code-${version}.tgz"; 16 hash = "sha256-Ch55xuJZJ0LXDTIlC7Ya381jqeGJzYC5IDEY0hS76/M="; 17 }; 18 19 npmDepsHash = "sha256-iekpD6RTMRHaV2ifogoestwpq3W+JkesjGVlhtGwHQQ="; 20 21 postPatch = '' 22 cp ${./package-lock.json} package-lock.json 23 ''; 24 25 dontNpmBuild = true; 26 27 AUTHORIZED = "1"; 28 29 # `claude-code` tries to auto-update by default, this disables that functionality. 30 # https://docs.anthropic.com/en/docs/agents-and-tools/claude-code/overview#environment-variables 31 # The DEV=true env var causes claude to crash with `TypeError: window.WebSocket is not a constructor` 32 postInstall = '' 33 wrapProgram $out/bin/claude \ 34 --set DISABLE_AUTOUPDATER 1 \ 35 --unset DEV 36 ''; 37 38 passthru.updateScript = ./update.sh; 39 40 meta = { 41 description = "Agentic coding tool that lives in your terminal, understands your codebase, and helps you code faster"; 42 homepage = "https://github.com/anthropics/claude-code"; 43 downloadPage = "https://www.npmjs.com/package/@anthropic-ai/claude-code"; 44 license = lib.licenses.unfree; 45 maintainers = with lib.maintainers; [ 46 malo 47 markus1189 48 omarjatoi 49 ]; 50 mainProgram = "claude"; 51 }; 52}