- Updated `@anthropic-ai/claude-code` package to version 2.0.25. - Revised hashes in `package.nix` and `package-lock.json` for the new release. - Added `writableTmpDirAsHomeHook` and `versionCheckHook` for install checks. - Refined update script to use `--generate-lockfile` and handle unfree dependencies.
59 lines
1.6 KiB
Nix
59 lines
1.6 KiB
Nix
{
|
|
lib,
|
|
buildNpmPackage,
|
|
fetchzip,
|
|
writableTmpDirAsHomeHook,
|
|
versionCheckHook,
|
|
}:
|
|
buildNpmPackage (finalAttrs: {
|
|
pname = "claude-code";
|
|
version = "2.0.25";
|
|
|
|
src = fetchzip {
|
|
url = "https://registry.npmjs.org/@anthropic-ai/claude-code/-/claude-code-${finalAttrs.version}.tgz";
|
|
hash = "sha256-ix/JSPBLnvCPtyqJ6beAaOpuimphpkrkIw5HCdeeGkM=";
|
|
};
|
|
|
|
npmDepsHash = "sha256-NjmCmOwepKaSZ+vji0sUlZ1nSkcG02kNokGe37YYtX0=";
|
|
|
|
postPatch = ''
|
|
cp ${./package-lock.json} package-lock.json
|
|
'';
|
|
|
|
dontNpmBuild = true;
|
|
|
|
env.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
|
|
'';
|
|
|
|
doInstallCheck = true;
|
|
nativeInstallCheckInputs = [
|
|
writableTmpDirAsHomeHook
|
|
versionCheckHook
|
|
];
|
|
versionCheckKeepEnvironment = [ "HOME" ];
|
|
versionCheckProgramArg = "--version";
|
|
|
|
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
|
|
xiaoxiangmoe
|
|
];
|
|
mainProgram = "claude";
|
|
};
|
|
})
|