diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-01-29 19:14:38 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-01-29 19:14:38 +0900 |
| commit | f981cd0f054309d5a238df8f2e452f6c78b2e920 (patch) | |
| tree | 68b34dd9ef4d8ca370b5e76c6a07429eacb27d40 | |
| parent | d8a737f52082151bc180917f84bd6f029f0ec71a (diff) | |
| download | nur-packages-f981cd0f054309d5a238df8f2e452f6c78b2e920.tar.gz nur-packages-f981cd0f054309d5a238df8f2e452f6c78b2e920.tar.zst nur-packages-f981cd0f054309d5a238df8f2e452f6c78b2e920.zip | |
feat(claude-code): upgrade to 2.1.23
| -rw-r--r-- | justfile | 21 | ||||
| -rw-r--r-- | pkgs/claude-code/default.nix | 98 | ||||
| -rw-r--r-- | pkgs/claude-code/manifest.json | 34 | ||||
| -rw-r--r-- | pkgs/claude-code/package-lock.json | 314 | ||||
| -rwxr-xr-x | pkgs/claude-code/update.sh | 12 |
5 files changed, 116 insertions, 363 deletions
@@ -2,22 +2,5 @@ commit-upgrade PKG VERSION: git commit -m 'feat({{PKG}}): upgrade to {{VERSION}}' update-claude-code: - #!/usr/bin/env bash - set -eu - - export NIXPKGS_ALLOW_UNFREE=1 - LATEST_VERSION=$(npm view @anthropic-ai/claude-code version) - - sed -i 's|version = ".*"|version = "'"$LATEST_VERSION"'"|' pkgs/claude-code/default.nix - sed -i 's|hash = ".*"|hash = ""|' pkgs/claude-code/default.nix - sed -i 's|npmDepsHash = ".*"|npmDepsHash = ""|' pkgs/claude-code/default.nix - - sed -i '1,10s|"version": ".*"|"version": "'"$LATEST_VERSION"'"|' pkgs/claude-code/package-lock.json - - HASH="$(nix build --impure ".#claude-code" 2>&1 | grep "got:" | awk '{ print $2 }')" - sed -i 's|hash = ""|hash = "'"$HASH"'"|' pkgs/claude-code/default.nix - - NPM_DEPS_HASH="$(nix build --impure ".#claude-code" 2>&1 | grep "got:" | awk '{ print $2 }')" - sed -i 's|npmDepsHash = ""|npmDepsHash = "'"$NPM_DEPS_HASH"'"|' pkgs/claude-code/default.nix - - nix build --impure ".#claude-code" + pkgs/claude-code/update.sh + NIXPKGS_ALLOW_UNFREE=1 nix build --impure ".#claude-code" diff --git a/pkgs/claude-code/default.nix b/pkgs/claude-code/default.nix index 9d514bd..a84e696 100644 --- a/pkgs/claude-code/default.nix +++ b/pkgs/claude-code/default.nix @@ -1,42 +1,74 @@ -# https://github.com/NixOS/nixpkgs/blob/ffbc9f8cbaacfb331b6017d5a5abb21a492c9a38/pkgs/by-name/cl/claude-code/package.nix +# https://github.com/NixOS/nixpkgs/blob/4bf6c8d6f2d10c7924c08c7d51e02d6702484960/pkgs/by-name/cl/claude-code-bin/package.nix -# 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"] ["vscode-extensions" "anthropic" "claude-code"]])' -# ``` { lib, - buildNpmPackage, - fetchzip, - writableTmpDirAsHomeHook, + stdenvNoCC, + fetchurl, + installShellFiles, + makeBinaryWrapper, + autoPatchelfHook, + procps, + ripgrep, + bubblewrap, + socat, versionCheckHook, + writableTmpDirAsHomeHook, }: -buildNpmPackage (finalAttrs: { - pname = "claude-code"; - version = "2.1.22"; +let + stdenv = stdenvNoCC; + baseUrl = "https://storage.googleapis.com/claude-code-dist-86c565f3-f756-42ad-8dfa-d59b1c096819/claude-code-releases"; + manifest = lib.importJSON ./manifest.json; + platformKey = "${stdenv.hostPlatform.node.platform}-${stdenv.hostPlatform.node.arch}"; + platformManifestEntry = manifest.platforms.${platformKey}; +in +stdenv.mkDerivation (finalAttrs: { + pname = "claude-code-bin"; + inherit (manifest) version; - src = fetchzip { - url = "https://registry.npmjs.org/@anthropic-ai/claude-code/-/claude-code-${finalAttrs.version}.tgz"; - hash = "sha256-vy7osk3UAOEgsJx9jdcGe2wICOk5Urzxh1WLAHyHM+U="; + src = fetchurl { + url = "${baseUrl}/${finalAttrs.version}/${platformKey}/claude"; + sha256 = platformManifestEntry.checksum; }; - npmDepsHash = "sha256-W3q8N01oPRDd6HuMBjvGD9zPvJZjr0KnfoSQEoADq4U="; + dontUnpack = true; + dontBuild = true; + __noChroot = stdenv.hostPlatform.isDarwin; + # otherwise the bun runtime is executed instead of the binary + dontStrip = true; - postPatch = '' - cp ${./package-lock.json} package-lock.json - ''; + nativeBuildInputs = [ + installShellFiles + makeBinaryWrapper + ] + ++ lib.optionals stdenv.hostPlatform.isElf [ autoPatchelfHook ]; - dontNpmBuild = true; + strictDeps = true; - env.AUTHORIZED = "1"; + installPhase = '' + runHook preInstall + + installBin $src - # `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 + --set USE_BUILTIN_RIPGREP 0 \ + --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 + # https://code.claude.com/docs/en/troubleshooting#search-and-discovery-issues + ripgrep + ] + # the following packages are required for the sandbox to work (Linux only) + ++ lib.optionals stdenv.hostPlatform.isLinux [ + bubblewrap + socat + ] + ) + } + + runHook postInstall ''; doInstallCheck = true; @@ -45,20 +77,26 @@ buildNpmPackage (finalAttrs: { 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"; + downloadPage = "https://claude.com/product/claude-code"; + changelog = "https://github.com/anthropics/claude-code/blob/main/CHANGELOG.md"; license = lib.licenses.unfree; + sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ]; + platforms = [ + "aarch64-darwin" + "x86_64-darwin" + "aarch64-linux" + "x86_64-linux" + ]; maintainers = with lib.maintainers; [ - adeci - malo - markus1189 - omarjatoi xiaoxiangmoe + mirkolenz ]; mainProgram = "claude"; }; diff --git a/pkgs/claude-code/manifest.json b/pkgs/claude-code/manifest.json new file mode 100644 index 0000000..72bc482 --- /dev/null +++ b/pkgs/claude-code/manifest.json @@ -0,0 +1,34 @@ +{ + "version": "2.1.23", + "buildDate": "2026-01-29T00:21:09Z", + "platforms": { + "darwin-arm64": { + "checksum": "80e39bbc7cbbc7dea101dcf35676a270d5bff25a8a8e29ab038ceb131d8a7b3d", + "size": 182288624 + }, + "darwin-x64": { + "checksum": "f22d8b1db63e631bd2a97ba14a0b924d9a8102d06efdc216228a42f93d665bbc", + "size": 188585664 + }, + "linux-arm64": { + "checksum": "4b45afbb3ea3708ef6ed5038a7cc32054487f1fb577f56e9418b83d163f88f32", + "size": 216667612 + }, + "linux-x64": { + "checksum": "eff6d12c8220260b8d6926b35de20daae0db43de236920762c7da4c9d20dc843", + "size": 224472904 + }, + "linux-arm64-musl": { + "checksum": "d7fba642cd4fcd3f2cdbcd220b007df4a2764c8affa44f9b33e030cc9835b3c5", + "size": 211931644 + }, + "linux-x64-musl": { + "checksum": "7ea0c609e5092e723481c8a27de4f36fd1a21f7c0eb13c32ec780013b349640f", + "size": 217161480 + }, + "win32-x64": { + "checksum": "951d3a834691017241988654032de0c0341741210efbcfa56fb6ea50afdec13a", + "size": 234309792 + } + } +} diff --git a/pkgs/claude-code/package-lock.json b/pkgs/claude-code/package-lock.json deleted file mode 100644 index 64a49b2..0000000 --- a/pkgs/claude-code/package-lock.json +++ /dev/null @@ -1,314 +0,0 @@ -{ - "name": "@anthropic-ai/claude-code", - "version": "2.1.22", - "lockfileVersion": 3, - "requires": true, - "packages": { - "": { - "name": "@anthropic-ai/claude-code", - "version": "2.1.22", - "license": "SEE LICENSE IN README.md", - "bin": { - "claude": "cli.js" - }, - "engines": { - "node": ">=18.0.0" - }, - "optionalDependencies": { - "@img/sharp-darwin-arm64": "^0.33.5", - "@img/sharp-darwin-x64": "^0.33.5", - "@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" - } - }, - "node_modules/@img/sharp-darwin-arm64": { - "version": "0.33.5", - "resolved": "https://registry.npmjs.org/@img/sharp-darwin-arm64/-/sharp-darwin-arm64-0.33.5.tgz", - "integrity": "sha512-UT4p+iz/2H4twwAoLCqfA9UH5pI6DggwKEGuaPy7nCVQ8ZsiY5PIcrRvD1DzuY3qYL07NtIQcWnBSY/heikIFQ==", - "cpu": [ - "arm64" - ], - "license": "Apache-2.0", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": "^18.17.0 || ^20.3.0 || >=21.0.0" - }, - "funding": { - "url": "https://opencollective.com/libvips" - }, - "optionalDependencies": { - "@img/sharp-libvips-darwin-arm64": "1.0.4" - } - }, - "node_modules/@img/sharp-darwin-x64": { - "version": "0.33.5", - "resolved": "https://registry.npmjs.org/@img/sharp-darwin-x64/-/sharp-darwin-x64-0.33.5.tgz", - "integrity": "sha512-fyHac4jIc1ANYGRDxtiqelIbdWkIuQaI84Mv45KvGRRxSAa7o7d1ZKAOBaYbnepLC1WqxfpimdeWfvqqSGwR2Q==", - "cpu": [ - "x64" - ], - "license": "Apache-2.0", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": "^18.17.0 || ^20.3.0 || >=21.0.0" - }, - "funding": { - "url": "https://opencollective.com/libvips" - }, - "optionalDependencies": { - "@img/sharp-libvips-darwin-x64": "1.0.4" - } - }, - "node_modules/@img/sharp-libvips-darwin-arm64": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/@img/sharp-libvips-darwin-arm64/-/sharp-libvips-darwin-arm64-1.0.4.tgz", - "integrity": "sha512-XblONe153h0O2zuFfTAbQYAX2JhYmDHeWikp1LM9Hul9gVPjFY427k6dFEcOL72O01QxQsWi761svJ/ev9xEDg==", - "cpu": [ - "arm64" - ], - "license": "LGPL-3.0-or-later", - "optional": true, - "os": [ - "darwin" - ], - "funding": { - "url": "https://opencollective.com/libvips" - } - }, - "node_modules/@img/sharp-libvips-darwin-x64": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/@img/sharp-libvips-darwin-x64/-/sharp-libvips-darwin-x64-1.0.4.tgz", - "integrity": "sha512-xnGR8YuZYfJGmWPvmlunFaWJsb9T/AO2ykoP3Fz/0X5XV2aoYBPkX6xqCQvUTKKiLddarLaxpzNe+b1hjeWHAQ==", - "cpu": [ - "x64" - ], - "license": "LGPL-3.0-or-later", - "optional": true, - "os": [ - "darwin" - ], - "funding": { - "url": "https://opencollective.com/libvips" - } - }, - "node_modules/@img/sharp-libvips-linux-arm": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-arm/-/sharp-libvips-linux-arm-1.0.5.tgz", - "integrity": "sha512-gvcC4ACAOPRNATg/ov8/MnbxFDJqf/pDePbBnuBDcjsI8PssmjoKMAz4LtLaVi+OnSb5FK/yIOamqDwGmXW32g==", - "cpu": [ - "arm" - ], - "license": "LGPL-3.0-or-later", - "optional": true, - "os": [ - "linux" - ], - "funding": { - "url": "https://opencollective.com/libvips" - } - }, - "node_modules/@img/sharp-libvips-linux-arm64": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-arm64/-/sharp-libvips-linux-arm64-1.0.4.tgz", - "integrity": "sha512-9B+taZ8DlyyqzZQnoeIvDVR/2F4EbMepXMc/NdVbkzsJbzkUjhXv/70GQJ7tdLA4YJgNP25zukcxpX2/SueNrA==", - "cpu": [ - "arm64" - ], - "license": "LGPL-3.0-or-later", - "optional": true, - "os": [ - "linux" - ], - "funding": { - "url": "https://opencollective.com/libvips" - } - }, - "node_modules/@img/sharp-libvips-linux-x64": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-x64/-/sharp-libvips-linux-x64-1.0.4.tgz", - "integrity": "sha512-MmWmQ3iPFZr0Iev+BAgVMb3ZyC4KeFc3jFxnNbEPas60e1cIfevbtuyf9nDGIzOaW9PdnDciJm+wFFaTlj5xYw==", - "cpu": [ - "x64" - ], - "license": "LGPL-3.0-or-later", - "optional": true, - "os": [ - "linux" - ], - "funding": { - "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", - "integrity": "sha512-JTS1eldqZbJxjvKaAkxhZmBqPRGmxgu+qFKSInv8moZ2AmT5Yib3EQ1c6gp493HvrvV8QgdOXdyaIBrhvFhBMQ==", - "cpu": [ - "arm" - ], - "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-linux-arm": "1.0.5" - } - }, - "node_modules/@img/sharp-linux-arm64": { - "version": "0.33.5", - "resolved": "https://registry.npmjs.org/@img/sharp-linux-arm64/-/sharp-linux-arm64-0.33.5.tgz", - "integrity": "sha512-JMVv+AMRyGOHtO1RFBiJy/MBsgz0x4AWrT6QoEVVTyh1E39TrCUpTRI7mx9VksGX4awWASxqCYLCV4wBZHAYxA==", - "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-linux-arm64": "1.0.4" - } - }, - "node_modules/@img/sharp-linux-x64": { - "version": "0.33.5", - "resolved": "https://registry.npmjs.org/@img/sharp-linux-x64/-/sharp-linux-x64-0.33.5.tgz", - "integrity": "sha512-opC+Ok5pRNAzuvq1AG0ar+1owsu842/Ab+4qvU879ippJBHvyY5n2mxF1izXqkPYlGuP/M556uh53jRLJmzTWA==", - "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-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", - "integrity": "sha512-MpY/o8/8kj+EcnxwvrP4aTJSWw/aZ7JIGR4aBeZkZw5B7/Jn+tY9/VNwtcoGmdT7GfggGIU4kygOMSbYnOrAbg==", - "cpu": [ - "x64" - ], - "license": "Apache-2.0 AND LGPL-3.0-or-later", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": "^18.17.0 || ^20.3.0 || >=21.0.0" - }, - "funding": { - "url": "https://opencollective.com/libvips" - } - } - } -} diff --git a/pkgs/claude-code/update.sh b/pkgs/claude-code/update.sh new file mode 100755 index 0000000..547103f --- /dev/null +++ b/pkgs/claude-code/update.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env nix +#!nix shell --ignore-environment nixpkgs#cacert nixpkgs#curl nixpkgs#bash --command bash +# +# https://github.com/NixOS/nixpkgs/blob/4bf6c8d6f2d10c7924c08c7d51e02d6702484960/pkgs/by-name/cl/claude-code-bin/update.sh + +set -euo pipefail + +BASE_URL="https://storage.googleapis.com/claude-code-dist-86c565f3-f756-42ad-8dfa-d59b1c096819/claude-code-releases" + +VERSION=$(curl -fsSL "$BASE_URL/latest") + +curl -fsSL "$BASE_URL/$VERSION/manifest.json" --output pkgs/claude-code/manifest.json |
