feat(nix): update claude-code package and dependencies
- Upgraded `claude-code` to version 2.1.34 and updated associated npm dependencies and hash values. - Refactored `update.sh` to use `nix shell` instead of `nix-shell` for improved compatibility. - Added musl-based `sharp` dependencies and adjusted sandbox requirements in `package.nix`.
This commit is contained in:
parent
9b42e808d3
commit
4bc62866a8
4 changed files with 124 additions and 13 deletions
82
overlays/unstable/claude-code/package-lock.json
generated
82
overlays/unstable/claude-code/package-lock.json
generated
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "@anthropic-ai/claude-code",
|
||||
"version": "2.0.50",
|
||||
"version": "2.1.34",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@anthropic-ai/claude-code",
|
||||
"version": "2.0.50",
|
||||
"version": "2.1.34",
|
||||
"license": "SEE LICENSE IN README.md",
|
||||
"bin": {
|
||||
"claude": "cli.js"
|
||||
|
|
@ -20,6 +20,8 @@
|
|||
"@img/sharp-linux-arm": "^0.33.5",
|
||||
"@img/sharp-linux-arm64": "^0.33.5",
|
||||
"@img/sharp-linux-x64": "^0.33.5",
|
||||
"@img/sharp-linuxmusl-arm64": "^0.33.5",
|
||||
"@img/sharp-linuxmusl-x64": "^0.33.5",
|
||||
"@img/sharp-win32-x64": "^0.33.5"
|
||||
}
|
||||
},
|
||||
|
|
@ -147,6 +149,38 @@
|
|||
"url": "https://opencollective.com/libvips"
|
||||
}
|
||||
},
|
||||
"node_modules/@img/sharp-libvips-linuxmusl-arm64": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/@img/sharp-libvips-linuxmusl-arm64/-/sharp-libvips-linuxmusl-arm64-1.0.4.tgz",
|
||||
"integrity": "sha512-9Ti+BbTYDcsbp4wfYib8Ctm1ilkugkA/uscUn6UXK1ldpC1JjiXbLfFZtRlBhjPZ5o1NCLiDbg8fhUPKStHoTA==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"license": "LGPL-3.0-or-later",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"funding": {
|
||||
"url": "https://opencollective.com/libvips"
|
||||
}
|
||||
},
|
||||
"node_modules/@img/sharp-libvips-linuxmusl-x64": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/@img/sharp-libvips-linuxmusl-x64/-/sharp-libvips-linuxmusl-x64-1.0.4.tgz",
|
||||
"integrity": "sha512-viYN1KX9m+/hGkJtvYYp+CCLgnJXwiQB39damAO7WMdKWlIhmYTfHjwSbQeUK/20vY154mwezd9HflVFM1wVSw==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"license": "LGPL-3.0-or-later",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"funding": {
|
||||
"url": "https://opencollective.com/libvips"
|
||||
}
|
||||
},
|
||||
"node_modules/@img/sharp-linux-arm": {
|
||||
"version": "0.33.5",
|
||||
"resolved": "https://registry.npmjs.org/@img/sharp-linux-arm/-/sharp-linux-arm-0.33.5.tgz",
|
||||
|
|
@ -213,6 +247,50 @@
|
|||
"@img/sharp-libvips-linux-x64": "1.0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/@img/sharp-linuxmusl-arm64": {
|
||||
"version": "0.33.5",
|
||||
"resolved": "https://registry.npmjs.org/@img/sharp-linuxmusl-arm64/-/sharp-linuxmusl-arm64-0.33.5.tgz",
|
||||
"integrity": "sha512-XrHMZwGQGvJg2V/oRSUfSAfjfPxO+4DkiRh6p2AFjLQztWUuY/o8Mq0eMQVIY7HJ1CDQUJlxGGZRw1a5bqmd1g==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"license": "Apache-2.0",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": "^18.17.0 || ^20.3.0 || >=21.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://opencollective.com/libvips"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"@img/sharp-libvips-linuxmusl-arm64": "1.0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/@img/sharp-linuxmusl-x64": {
|
||||
"version": "0.33.5",
|
||||
"resolved": "https://registry.npmjs.org/@img/sharp-linuxmusl-x64/-/sharp-linuxmusl-x64-0.33.5.tgz",
|
||||
"integrity": "sha512-WT+d/cgqKkkKySYmqoZ8y3pxx7lx9vVejxW/W4DOFMYVSkErR+w7mf2u8m/y4+xHe7yY9DAXQMWQhpnMuFfScw==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"license": "Apache-2.0",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": "^18.17.0 || ^20.3.0 || >=21.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://opencollective.com/libvips"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"@img/sharp-libvips-linuxmusl-x64": "1.0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/@img/sharp-win32-x64": {
|
||||
"version": "0.33.5",
|
||||
"resolved": "https://registry.npmjs.org/@img/sharp-win32-x64/-/sharp-win32-x64-0.33.5.tgz",
|
||||
|
|
|
|||
|
|
@ -1,23 +1,37 @@
|
|||
# NOTE: Use the following command to update the package
|
||||
# ```sh
|
||||
# nix-shell maintainers/scripts/update.nix --argstr commit true --arg predicate '(path: pkg: builtins.elem path [["claude-code"] ["claude-code-bin"] ["vscode-extensions" "anthropic" "claude-code"]])'
|
||||
# ```
|
||||
{
|
||||
lib,
|
||||
stdenv,
|
||||
buildNpmPackage,
|
||||
fetchzip,
|
||||
writableTmpDirAsHomeHook,
|
||||
versionCheckHook,
|
||||
writableTmpDirAsHomeHook,
|
||||
bubblewrap,
|
||||
procps,
|
||||
socat,
|
||||
}:
|
||||
buildNpmPackage (finalAttrs: {
|
||||
pname = "claude-code";
|
||||
version = "2.0.51";
|
||||
version = "2.1.34";
|
||||
|
||||
src = fetchzip {
|
||||
url = "https://registry.npmjs.org/@anthropic-ai/claude-code/-/claude-code-${finalAttrs.version}.tgz";
|
||||
hash = "sha256-rfJZaACY+Kbm+0lWOPwAfl/x2yFxskLKZpJJhqlccSY=";
|
||||
hash = "sha256-J3kltFY5nR3PsRWbW310VqD/6hhfMbVSvynv0eaIi3M=";
|
||||
};
|
||||
|
||||
npmDepsHash = "sha256-/5Qh99vAcTiFz6FrzJgm26RserqxVjLYqOOx5q5hkgc=";
|
||||
npmDepsHash = "sha256-n762einDxLUUXWMsfdPVhA/kn0ywlJgFQ2ZGoEk3E68=";
|
||||
|
||||
strictDeps = true;
|
||||
|
||||
postPatch = ''
|
||||
cp ${./package-lock.json} package-lock.json
|
||||
|
||||
# https://github.com/anthropics/claude-code/issues/15195
|
||||
substituteInPlace cli.js \
|
||||
--replace-fail '#!/bin/sh' '#!/usr/bin/env sh'
|
||||
'';
|
||||
|
||||
dontNpmBuild = true;
|
||||
|
|
@ -30,7 +44,21 @@ buildNpmPackage (finalAttrs: {
|
|||
postInstall = ''
|
||||
wrapProgram $out/bin/claude \
|
||||
--set DISABLE_AUTOUPDATER 1 \
|
||||
--unset DEV
|
||||
--set DISABLE_INSTALLATION_CHECKS 1 \
|
||||
--unset DEV \
|
||||
--prefix PATH : ${
|
||||
lib.makeBinPath (
|
||||
[
|
||||
# claude-code uses [node-tree-kill](https://github.com/pkrumins/node-tree-kill) which requires procps's pgrep(darwin) or ps(linux)
|
||||
procps
|
||||
]
|
||||
# the following packages are required for the sandbox to work (Linux only)
|
||||
++ lib.optionals stdenv.hostPlatform.isLinux [
|
||||
bubblewrap
|
||||
socat
|
||||
]
|
||||
)
|
||||
}
|
||||
'';
|
||||
|
||||
doInstallCheck = true;
|
||||
|
|
@ -39,7 +67,6 @@ buildNpmPackage (finalAttrs: {
|
|||
versionCheckHook
|
||||
];
|
||||
versionCheckKeepEnvironment = [ "HOME" ];
|
||||
versionCheckProgramArg = "--version";
|
||||
|
||||
passthru.updateScript = ./update.sh;
|
||||
|
||||
|
|
@ -49,6 +76,7 @@ buildNpmPackage (finalAttrs: {
|
|||
downloadPage = "https://www.npmjs.com/package/@anthropic-ai/claude-code";
|
||||
license = lib.licenses.unfree;
|
||||
maintainers = with lib.maintainers; [
|
||||
adeci
|
||||
malo
|
||||
markus1189
|
||||
omarjatoi
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env nix-shell
|
||||
#!nix-shell --pure --keep NIX_PATH -i bash --packages nodejs nix-update git cacert
|
||||
#!/usr/bin/env nix
|
||||
#!nix shell --ignore-environment .#cacert .#nodejs .#git .#nix-update .#nix .#gnused .#findutils .#bash --command bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
|
|
@ -7,4 +7,9 @@ version=$(npm view @anthropic-ai/claude-code version)
|
|||
|
||||
# Update version and hashes
|
||||
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"
|
||||
|
||||
# nix-update can't update package-lock.json along with npmDepsHash
|
||||
# TODO: Remove this workaround if nix-update can update package-lock.json along with npmDepsHash.
|
||||
(nix-build --expr '((import ./.) { system = builtins.currentSystem; }).claude-code.npmDeps.overrideAttrs { outputHash = ""; outputHashAlgo = "sha256"; }' 2>&1 || true) \
|
||||
| sed -nE '$s/ *got: *(sha256-[A-Za-z0-9+/=-]+).*/\1/p' \
|
||||
| xargs -I{} sed -i 's|npmDepsHash = "sha256-[^"]*";|npmDepsHash = "{}";|' pkgs/by-name/cl/claude-code/package.nix
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ final: prev: {
|
|||
gemini-cli
|
||||
# opencode
|
||||
tailscale
|
||||
claude-code
|
||||
# claude-code
|
||||
# open-webui
|
||||
# vscode
|
||||
# nodejs_20
|
||||
|
|
@ -19,7 +19,7 @@ final: prev: {
|
|||
*/
|
||||
|
||||
# goose-cli = channels.unstable.callPackage ./goose.nix { };
|
||||
# claude-code = channels.unstable.callPackage ./claude-code/package.nix { };
|
||||
claude-code = channels.unstable.callPackage ./claude-code/package.nix { };
|
||||
# gemini-cli = channels.unstable.callPackage ./gemini-cli/package.nix { };
|
||||
# vscode-extensions = channels.unstable.vscode-extensions // {
|
||||
# rooveterinaryinc = { roo-cline = channels.unstable.callPackage ./roo-code.nix { }; };
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue