diff --git a/overlays/unstable/claude-code/manifest.json b/overlays/unstable/claude-code/manifest.json index 6dbf791..774b348 100644 --- a/overlays/unstable/claude-code/manifest.json +++ b/overlays/unstable/claude-code/manifest.json @@ -1,47 +1,47 @@ { - "version": "2.1.126", - "commit": "e44c1d97bd39dbf2525164f3fd33be6edbf1661e", - "buildDate": "2026-04-30T16:08:06Z", + "version": "2.1.119", + "commit": "6f68554839756189e277b8285a18fe47acd9a5a1", + "buildDate": "2026-04-23T20:45:14Z", "platforms": { "darwin-arm64": { "binary": "claude", - "checksum": "87a1d05018ceadfc1fe616bfc10262b0503f51986f4af2dc42d1ed856ed3f7bb", - "size": 216260096 + "checksum": "31db3444309d5d0f8b85e8782e2dcd86f31f7e48c1a1e83d69b09268c7b4f9a2", + "size": 213404000 }, "darwin-x64": { "binary": "claude", - "checksum": "49a90c474383a9eda11310bd71f7ea6bb91361ec99443b733cb5003f6e703ccb", - "size": 217824336 + "checksum": "52b3b75cfe80c626982b2ffb3a6ce1c797824f257dc275cf0a3c32c202b6a3df", + "size": 214951760 }, "linux-arm64": { "binary": "claude", - "checksum": "88a6dca613a40559f3bac8a946a2ec6e60a870b91938d3df93dcac1dec4848cb", - "size": 248318528 + "checksum": "382aa73ea4b07fd8d698e3159b5ef9e1b8739fae7505ba8ddd28b8a6a62819ce", + "size": 245500480 }, "linux-x64": { "binary": "claude", - "checksum": "fce96968d275161ff65a4c19fc6434efc6973d9f6d35dc3992a2ba0553cac18e", - "size": 248105600 + "checksum": "cca43053f062949495596b11b6fd1b59cf79102adb13bacbe66997e6fae41e4a", + "size": 245230208 }, "linux-arm64-musl": { "binary": "claude", - "checksum": "042bbc0c3610d005d371645e34c4b4055bb2499f7a4509ed667b2a8924ac5853", - "size": 241043840 + "checksum": "e09bfaedd8bfdeaebe5f1cf9bb81ebeb718312c68fffce379fb51786263143d0", + "size": 238225856 }, "linux-x64-musl": { "binary": "claude", - "checksum": "b3f39b00069558e57c6d36ead6b2efe013afa57b603445c338374d0c873e95c0", - "size": 242370944 + "checksum": "ef41a11653b39c14db2d343f1f5e2a3af7eb9871c63e64deb6e65919670a4e0b", + "size": 239495616 }, "win32-x64": { "binary": "claude.exe", - "checksum": "1a6b4be4b45458ab1831bad138572bf2fec12cb1edea0685c5ff10ce6e97afb6", - "size": 254053024 + "checksum": "e18c7dcfad4a3f5d33d202ec2dde630b648cf5b41622154d6210e793c7cceadc", + "size": 254478496 }, "win32-arm64": { "binary": "claude.exe", - "checksum": "7253defbc945f5461035240bc32d18970fb1acc5df63092c492ee8d7c7caf55f", - "size": 250115744 + "checksum": "9e0deb10c45108612484ce558fad378206d5ac23feb203067450e6c38d001241", + "size": 251203232 } } } diff --git a/overlays/unstable/claude-code/package.nix b/overlays/unstable/claude-code/package.nix index ace4105..e25950b 100644 --- a/overlays/unstable/claude-code/package.nix +++ b/overlays/unstable/claude-code/package.nix @@ -1,78 +1,36 @@ -# 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, - stdenvNoCC, - fetchurl, - installShellFiles, - makeBinaryWrapper, - autoPatchelfHook, - procps, - ripgrep, - bubblewrap, - socat, - versionCheckHook, + buildNpmPackage, + fetchzip, writableTmpDirAsHomeHook, + versionCheckHook, }: -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: { +buildNpmPackage (finalAttrs: { pname = "claude-code"; - inherit (manifest) version; + version = "2.1.126"; - src = fetchurl { - url = "${baseUrl}/${finalAttrs.version}/${platformKey}/claude"; - sha256 = platformManifestEntry.checksum; + src = fetchzip { + url = "https://registry.npmjs.org/@anthropic-ai/claude-code/-/claude-code-${finalAttrs.version}.tgz"; + hash = "sha256-Il9MGrnnIV3i86cU3BjslGEdVodnV50VW3f2DEjSlMk="; }; - dontUnpack = true; - dontBuild = true; - __noChroot = stdenv.hostPlatform.isDarwin; - # otherwise the bun runtime is executed instead of the binary - dontStrip = true; + npmDepsHash = "sha256-/5Qh99vAcTiFz6FrzJgm26RserqxVjLYqOOx5q5hkgc="; - nativeBuildInputs = [ - installShellFiles - makeBinaryWrapper - ] - ++ lib.optionals stdenv.hostPlatform.isElf [ autoPatchelfHook ]; + postPatch = '' + cp ${./package-lock.json} package-lock.json + ''; - strictDeps = true; + dontNpmBuild = true; - installPhase = '' - runHook preInstall - - installBin $src + 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 + # 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 \ - --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 + --unset DEV ''; doInstallCheck = true; @@ -88,23 +46,12 @@ stdenv.mkDerivation (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://claude.com/product/claude-code"; - changelog = "https://github.com/anthropics/claude-code/blob/main/CHANGELOG.md"; + downloadPage = "https://www.npmjs.com/package/@anthropic-ai/claude-code"; 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 1e2125a..a3fe5d8 100755 --- a/overlays/unstable/claude-code/update.sh +++ b/overlays/unstable/claude-code/update.sh @@ -1,12 +1,10 @@ -#!/usr/bin/env nix -#!nix shell --ignore-environment .#cacert .#coreutils .#curl .#bash --command bash +#!/usr/bin/env nix-shell +#!nix-shell --pure --keep NIX_PATH -i bash --packages nodejs nix-update git cacert set -euo pipefail -cd "$(dirname "${BASH_SOURCE[0]}")" +version=$(npm view @anthropic-ai/claude-code 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 +# 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"