From 710be23bf524d4a0810c07cc087b1438bba65561 Mon Sep 17 00:00:00 2001 From: ZHAO Jin-Xiang Date: Thu, 22 Jan 2026 19:42:02 +0800 Subject: [PATCH] claude-code-bin: init at 2.1.20 --- pkgs/by-name/cl/claude-code-bin/manifest.json | 34 ++++++ pkgs/by-name/cl/claude-code-bin/package.nix | 101 ++++++++++++++++++ pkgs/by-name/cl/claude-code-bin/update.sh | 10 ++ pkgs/by-name/cl/claude-code/package.nix | 2 +- 4 files changed, 146 insertions(+), 1 deletion(-) create mode 100644 pkgs/by-name/cl/claude-code-bin/manifest.json create mode 100644 pkgs/by-name/cl/claude-code-bin/package.nix create mode 100755 pkgs/by-name/cl/claude-code-bin/update.sh diff --git a/pkgs/by-name/cl/claude-code-bin/manifest.json b/pkgs/by-name/cl/claude-code-bin/manifest.json new file mode 100644 index 000000000000..ce6494a756e8 --- /dev/null +++ b/pkgs/by-name/cl/claude-code-bin/manifest.json @@ -0,0 +1,34 @@ +{ + "version": "2.1.20", + "buildDate": "2026-01-27T00:41:34Z", + "platforms": { + "darwin-arm64": { + "checksum": "c5703596ed854ae8e5775cf38de5d71d8a56ecfe3f36904812870e9e34178c8c", + "size": 181661168 + }, + "darwin-x64": { + "checksum": "0d38292770c88bd9b13b0684afb0d2dc0028a1437d0c09be3449d2b3d369b045", + "size": 187958208 + }, + "linux-arm64": { + "checksum": "eb8801c7a4a8501b21c235f36674f17328e65e796cf8a6196b3bf9a23ae16f99", + "size": 216047898 + }, + "linux-x64": { + "checksum": "f9d3698f5378a486db2d4eea5c80f95c2ceb410fbcea9ffc5703b5aac9574fcc", + "size": 223852550 + }, + "linux-arm64-musl": { + "checksum": "2a7d24d2b85068c5aca6c014dd5f3f94bd8d55803a06f0d39eea776ab3282d76", + "size": 211311930 + }, + "linux-x64-musl": { + "checksum": "0b392cc1c268f0e48ceedee384535451013f69887a61e23f989e3b743373796a", + "size": 216541126 + }, + "win32-x64": { + "checksum": "12e88d78570b6e979f5cf290652dc45ca8b9327f43bb27e275f87146190bef05", + "size": 233703072 + } + } +} diff --git a/pkgs/by-name/cl/claude-code-bin/package.nix b/pkgs/by-name/cl/claude-code-bin/package.nix new file mode 100644 index 000000000000..d8635c169508 --- /dev/null +++ b/pkgs/by-name/cl/claude-code-bin/package.nix @@ -0,0 +1,101 @@ +{ + lib, + stdenvNoCC, + fetchurl, + installShellFiles, + makeBinaryWrapper, + autoPatchelfHook, + procps, + ripgrep, + bubblewrap, + socat, + versionCheckHook, + writableTmpDirAsHomeHook, +}: +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 = fetchurl { + url = "${baseUrl}/${finalAttrs.version}/${platformKey}/claude"; + sha256 = platformManifestEntry.checksum; + }; + + dontUnpack = true; + dontBuild = true; + __noChroot = stdenv.hostPlatform.isDarwin; + # otherwise the bun runtime is executed instead of the binary + dontStrip = true; + + nativeBuildInputs = [ + installShellFiles + makeBinaryWrapper + ] + ++ lib.optionals stdenv.hostPlatform.isElf [ autoPatchelfHook ]; + + strictDeps = true; + + installPhase = '' + runHook preInstall + + installBin $src + + wrapProgram $out/bin/claude \ + --set DISABLE_AUTOUPDATER 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; + nativeInstallCheckInputs = [ + writableTmpDirAsHomeHook + 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://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; [ + xiaoxiangmoe + mirkolenz + ]; + mainProgram = "claude"; + }; +}) diff --git a/pkgs/by-name/cl/claude-code-bin/update.sh b/pkgs/by-name/cl/claude-code-bin/update.sh new file mode 100755 index 000000000000..e60893c580f1 --- /dev/null +++ b/pkgs/by-name/cl/claude-code-bin/update.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env nix +#!nix shell --ignore-environment .#cacert .#curl .#bash --command bash + +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/by-name/cl/claude-code-bin/manifest.json diff --git a/pkgs/by-name/cl/claude-code/package.nix b/pkgs/by-name/cl/claude-code/package.nix index cfd075b0e2a4..bcf770316f5d 100644 --- a/pkgs/by-name/cl/claude-code/package.nix +++ b/pkgs/by-name/cl/claude-code/package.nix @@ -1,6 +1,6 @@ # 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"]])' +# 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,