From 14933e4e767a1c5ef64b8585d6de3402b2b2d096 Mon Sep 17 00:00:00 2001 From: Harald Hoyer Date: Fri, 1 May 2026 08:15:53 +0200 Subject: [PATCH] chore: claude-code update --- overlays/unstable/claude-code/manifest.json | 38 ++++----- overlays/unstable/claude-code/package.nix | 93 ++++++++++++++++----- overlays/unstable/claude-code/update.sh | 14 ++-- 3 files changed, 100 insertions(+), 45 deletions(-) diff --git a/overlays/unstable/claude-code/manifest.json b/overlays/unstable/claude-code/manifest.json index 774b348..6dbf791 100644 --- a/overlays/unstable/claude-code/manifest.json +++ b/overlays/unstable/claude-code/manifest.json @@ -1,47 +1,47 @@ { - "version": "2.1.119", - "commit": "6f68554839756189e277b8285a18fe47acd9a5a1", - "buildDate": "2026-04-23T20:45:14Z", + "version": "2.1.126", + "commit": "e44c1d97bd39dbf2525164f3fd33be6edbf1661e", + "buildDate": "2026-04-30T16:08:06Z", "platforms": { "darwin-arm64": { "binary": "claude", - "checksum": "31db3444309d5d0f8b85e8782e2dcd86f31f7e48c1a1e83d69b09268c7b4f9a2", - "size": 213404000 + "checksum": "87a1d05018ceadfc1fe616bfc10262b0503f51986f4af2dc42d1ed856ed3f7bb", + "size": 216260096 }, "darwin-x64": { "binary": "claude", - "checksum": "52b3b75cfe80c626982b2ffb3a6ce1c797824f257dc275cf0a3c32c202b6a3df", - "size": 214951760 + "checksum": "49a90c474383a9eda11310bd71f7ea6bb91361ec99443b733cb5003f6e703ccb", + "size": 217824336 }, "linux-arm64": { "binary": "claude", - "checksum": "382aa73ea4b07fd8d698e3159b5ef9e1b8739fae7505ba8ddd28b8a6a62819ce", - "size": 245500480 + "checksum": "88a6dca613a40559f3bac8a946a2ec6e60a870b91938d3df93dcac1dec4848cb", + "size": 248318528 }, "linux-x64": { "binary": "claude", - "checksum": "cca43053f062949495596b11b6fd1b59cf79102adb13bacbe66997e6fae41e4a", - "size": 245230208 + "checksum": "fce96968d275161ff65a4c19fc6434efc6973d9f6d35dc3992a2ba0553cac18e", + "size": 248105600 }, "linux-arm64-musl": { "binary": "claude", - "checksum": "e09bfaedd8bfdeaebe5f1cf9bb81ebeb718312c68fffce379fb51786263143d0", - "size": 238225856 + "checksum": "042bbc0c3610d005d371645e34c4b4055bb2499f7a4509ed667b2a8924ac5853", + "size": 241043840 }, "linux-x64-musl": { "binary": "claude", - "checksum": "ef41a11653b39c14db2d343f1f5e2a3af7eb9871c63e64deb6e65919670a4e0b", - "size": 239495616 + "checksum": "b3f39b00069558e57c6d36ead6b2efe013afa57b603445c338374d0c873e95c0", + "size": 242370944 }, "win32-x64": { "binary": "claude.exe", - "checksum": "e18c7dcfad4a3f5d33d202ec2dde630b648cf5b41622154d6210e793c7cceadc", - "size": 254478496 + "checksum": "1a6b4be4b45458ab1831bad138572bf2fec12cb1edea0685c5ff10ce6e97afb6", + "size": 254053024 }, "win32-arm64": { "binary": "claude.exe", - "checksum": "9e0deb10c45108612484ce558fad378206d5ac23feb203067450e6c38d001241", - "size": 251203232 + "checksum": "7253defbc945f5461035240bc32d18970fb1acc5df63092c492ee8d7c7caf55f", + "size": 250115744 } } } diff --git a/overlays/unstable/claude-code/package.nix b/overlays/unstable/claude-code/package.nix index 12d2d87..ace4105 100644 --- a/overlays/unstable/claude-code/package.nix +++ b/overlays/unstable/claude-code/package.nix @@ -1,36 +1,78 @@ +# 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: { +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"; - version = "2.1.126"; + inherit (manifest) version; - src = fetchzip { - url = "https://registry.npmjs.org/@anthropic-ai/claude-code/-/claude-code-${finalAttrs.version}.tgz"; - hash = "sha256-Il9MGrnnIV3i86cU3BjslGEdVodnV50VW3f2DEjSlMk="; + src = fetchurl { + url = "${baseUrl}/${finalAttrs.version}/${platformKey}/claude"; + sha256 = platformManifestEntry.checksum; }; - npmDepsHash = "sha256-tVQbjW2ZqzuH/MIpT8k5/OHBVLtuKPQt6P20TwBx3Cs="; + 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-default FORCE_AUTOUPDATE_PLUGINS 1 \ + --set DISABLE_INSTALLATION_CHECKS 1 \ + --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; @@ -46,12 +88,23 @@ buildNpmPackage (finalAttrs: { 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 + mirkolenz omarjatoi + oskarwires xiaoxiangmoe ]; mainProgram = "claude"; diff --git a/overlays/unstable/claude-code/update.sh b/overlays/unstable/claude-code/update.sh index a3fe5d8..1e2125a 100755 --- a/overlays/unstable/claude-code/update.sh +++ b/overlays/unstable/claude-code/update.sh @@ -1,10 +1,12 @@ -#!/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 .#coreutils .#curl .#bash --command bash set -euo pipefail -version=$(npm view @anthropic-ai/claude-code version) +cd "$(dirname "${BASH_SOURCE[0]}")" -# 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" +BASE_URL="https://storage.googleapis.com/claude-code-dist-86c565f3-f756-42ad-8dfa-d59b1c096819/claude-code-releases" + +VERSION="${1:-$(curl -fsSL "$BASE_URL/latest")}" + +curl -fsSL "$BASE_URL/$VERSION/manifest.json" --output manifest.json