feat(claude-code): update to version 2.0.25

- 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.
This commit is contained in:
Harald Hoyer 2025-10-23 09:22:33 +02:00
parent 83fea90a5e
commit 944d6bf040
3 changed files with 25 additions and 29 deletions

View file

@ -2,21 +2,19 @@
lib,
buildNpmPackage,
fetchzip,
nodejs_20,
writableTmpDirAsHomeHook,
versionCheckHook,
}:
buildNpmPackage rec {
buildNpmPackage (finalAttrs: {
pname = "claude-code";
version = "2.0.21";
nodejs = nodejs_20; # required for sandboxed Nix builds on Darwin
version = "2.0.25";
src = fetchzip {
url = "https://registry.npmjs.org/@anthropic-ai/claude-code/-/claude-code-${version}.tgz";
hash = "sha256-sX9btcy9uEHloAQNvCJFhwh0U/W14NWz2FjkdLXm1Q0=";
url = "https://registry.npmjs.org/@anthropic-ai/claude-code/-/claude-code-${finalAttrs.version}.tgz";
hash = "sha256-ix/JSPBLnvCPtyqJ6beAaOpuimphpkrkIw5HCdeeGkM=";
};
npmDepsHash = "sha256-LBc1M3FwWg6SP+p7GQ00LQfiYyhmU1OzsohDu6rukjA=";
npmDepsHash = "sha256-NjmCmOwepKaSZ+vji0sUlZ1nSkcG02kNokGe37YYtX0=";
postPatch = ''
cp ${./package-lock.json} package-lock.json
@ -24,7 +22,7 @@ buildNpmPackage rec {
dontNpmBuild = true;
AUTHORIZED = "1";
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
@ -35,6 +33,14 @@ buildNpmPackage rec {
--unset DEV
'';
doInstallCheck = true;
nativeInstallCheckInputs = [
writableTmpDirAsHomeHook
versionCheckHook
];
versionCheckKeepEnvironment = [ "HOME" ];
versionCheckProgramArg = "--version";
passthru.updateScript = ./update.sh;
meta = {
@ -46,7 +52,8 @@ buildNpmPackage rec {
malo
markus1189
omarjatoi
xiaoxiangmoe
];
mainProgram = "claude";
};
}
})