nixcfg/overlays/unstable/claude-code/package.nix
Harald Hoyer 26628cbe12 feat(claude-code): update to version 2.0.1
- Updated `@anthropic-ai/claude-code` package to version 2.0.1.
- Adjusted hashes in `package.nix` and `package-lock.json` for the new version.
- Added `--unset DEV` flag in `postInstall` script to prevent crashes.
2025-10-02 08:34:49 +02:00

52 lines
1.4 KiB
Nix

{
lib,
buildNpmPackage,
fetchzip,
nodejs_20,
}:
buildNpmPackage rec {
pname = "claude-code";
version = "2.0.1";
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-LUbDPFa0lY74MBU4hvmYVntt6hVZy6UUZFN0iB4Eno8=";
};
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";
};
}