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

@ -1,18 +1,12 @@
{
"name": "claude-code",
"version": "1.0.17",
"name": "@anthropic-ai/claude-code",
"version": "2.0.25",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"dependencies": {
"@anthropic-ai/claude-code": "^2.0.21"
}
},
"node_modules/@anthropic-ai/claude-code": {
"version": "2.0.21",
"resolved": "https://registry.npmjs.org/@anthropic-ai/claude-code/-/claude-code-2.0.21.tgz",
"integrity": "sha512-02NcxPVjioLjo4/djzIt4aAYkYqnZsHgdzgMexLURYLR9q1+B+OLkKddKwOHL8fas3WnUGV1oyybu73BfHqQ4A==",
"name": "@anthropic-ai/claude-code",
"version": "2.0.25",
"license": "SEE LICENSE IN README.md",
"bin": {
"claude": "cli.js"

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";
};
}
})

View file

@ -1,15 +1,10 @@
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p nodePackages.npm nix-update
#!nix-shell --pure --keep NIX_PATH -i bash --packages nodejs nix-update git
set -euo pipefail
version=$(npm view @anthropic-ai/claude-code version)
# Generate updated lock file
cd "$(dirname "${BASH_SOURCE[0]}")"
npm i --package-lock-only @anthropic-ai/claude-code@"$version"
rm -f package.json
# Update version and hashes
cd -
nix-update claude-code --version "$version"
AUTHORIZED=1 NIXPKGS_ALLOW_UNFREE=1 nix-update claude-code --version="$version" --generate-lockfile
nix-update vscode-extensions.anthropic.claude-code --use-update-script --version "$version"