feat: update claude-code
This commit is contained in:
parent
4045aa1859
commit
6bfaf7d2ec
3 changed files with 105 additions and 39 deletions
47
overlays/unstable/claude-code/manifest.json
Normal file
47
overlays/unstable/claude-code/manifest.json
Normal file
|
|
@ -0,0 +1,47 @@
|
||||||
|
{
|
||||||
|
"version": "2.1.119",
|
||||||
|
"commit": "6f68554839756189e277b8285a18fe47acd9a5a1",
|
||||||
|
"buildDate": "2026-04-23T20:45:14Z",
|
||||||
|
"platforms": {
|
||||||
|
"darwin-arm64": {
|
||||||
|
"binary": "claude",
|
||||||
|
"checksum": "31db3444309d5d0f8b85e8782e2dcd86f31f7e48c1a1e83d69b09268c7b4f9a2",
|
||||||
|
"size": 213404000
|
||||||
|
},
|
||||||
|
"darwin-x64": {
|
||||||
|
"binary": "claude",
|
||||||
|
"checksum": "52b3b75cfe80c626982b2ffb3a6ce1c797824f257dc275cf0a3c32c202b6a3df",
|
||||||
|
"size": 214951760
|
||||||
|
},
|
||||||
|
"linux-arm64": {
|
||||||
|
"binary": "claude",
|
||||||
|
"checksum": "382aa73ea4b07fd8d698e3159b5ef9e1b8739fae7505ba8ddd28b8a6a62819ce",
|
||||||
|
"size": 245500480
|
||||||
|
},
|
||||||
|
"linux-x64": {
|
||||||
|
"binary": "claude",
|
||||||
|
"checksum": "cca43053f062949495596b11b6fd1b59cf79102adb13bacbe66997e6fae41e4a",
|
||||||
|
"size": 245230208
|
||||||
|
},
|
||||||
|
"linux-arm64-musl": {
|
||||||
|
"binary": "claude",
|
||||||
|
"checksum": "e09bfaedd8bfdeaebe5f1cf9bb81ebeb718312c68fffce379fb51786263143d0",
|
||||||
|
"size": 238225856
|
||||||
|
},
|
||||||
|
"linux-x64-musl": {
|
||||||
|
"binary": "claude",
|
||||||
|
"checksum": "ef41a11653b39c14db2d343f1f5e2a3af7eb9871c63e64deb6e65919670a4e0b",
|
||||||
|
"size": 239495616
|
||||||
|
},
|
||||||
|
"win32-x64": {
|
||||||
|
"binary": "claude.exe",
|
||||||
|
"checksum": "e18c7dcfad4a3f5d33d202ec2dde630b648cf5b41622154d6210e793c7cceadc",
|
||||||
|
"size": 254478496
|
||||||
|
},
|
||||||
|
"win32-arm64": {
|
||||||
|
"binary": "claude.exe",
|
||||||
|
"checksum": "9e0deb10c45108612484ce558fad378206d5ac23feb203067450e6c38d001241",
|
||||||
|
"size": 251203232
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,57 +1,68 @@
|
||||||
# NOTE: Use the following command to update the package
|
# NOTE: Use the following command to update the package
|
||||||
# ```sh
|
# ```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"]])'
|
# nix-shell maintainers/scripts/update.nix --argstr commit true --arg predicate '(path: pkg: builtins.elem path [["claude-code"] ["vscode-extensions" "anthropic" "claude-code"]])'
|
||||||
# ```
|
# ```
|
||||||
{
|
{
|
||||||
lib,
|
lib,
|
||||||
stdenv,
|
stdenvNoCC,
|
||||||
buildNpmPackage,
|
fetchurl,
|
||||||
fetchzip,
|
installShellFiles,
|
||||||
|
makeBinaryWrapper,
|
||||||
|
autoPatchelfHook,
|
||||||
|
procps,
|
||||||
|
ripgrep,
|
||||||
|
bubblewrap,
|
||||||
|
socat,
|
||||||
versionCheckHook,
|
versionCheckHook,
|
||||||
writableTmpDirAsHomeHook,
|
writableTmpDirAsHomeHook,
|
||||||
bubblewrap,
|
|
||||||
procps,
|
|
||||||
socat,
|
|
||||||
}:
|
}:
|
||||||
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";
|
pname = "claude-code";
|
||||||
version = "2.1.112";
|
inherit (manifest) version;
|
||||||
|
|
||||||
src = fetchzip {
|
src = fetchurl {
|
||||||
url = "https://registry.npmjs.org/@anthropic-ai/claude-code/-/claude-code-${finalAttrs.version}.tgz";
|
url = "${baseUrl}/${finalAttrs.version}/${platformKey}/claude";
|
||||||
hash = "sha256-SJJqU7XHbu9IRGPMJNUg6oaMZiQUKqJhI2wm7BnR1gs=";
|
sha256 = platformManifestEntry.checksum;
|
||||||
};
|
};
|
||||||
|
|
||||||
npmDepsHash = "sha256-bdkej9Z41GLew9wi1zdNX+Asauki3nT1+SHmBmaUIBU=";
|
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;
|
strictDeps = true;
|
||||||
|
|
||||||
postPatch = ''
|
installPhase = ''
|
||||||
cp ${./package-lock.json} package-lock.json
|
runHook preInstall
|
||||||
|
|
||||||
# https://github.com/anthropics/claude-code/issues/15195
|
installBin $src
|
||||||
substituteInPlace cli.js \
|
|
||||||
--replace-fail '#!/bin/sh' '#!/usr/bin/env sh'
|
|
||||||
'';
|
|
||||||
|
|
||||||
dontNpmBuild = true;
|
|
||||||
|
|
||||||
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 \
|
wrapProgram $out/bin/claude \
|
||||||
--set DISABLE_AUTOUPDATER 1 \
|
--set DISABLE_AUTOUPDATER 1 \
|
||||||
--set-default FORCE_AUTOUPDATE_PLUGINS 1 \
|
--set-default FORCE_AUTOUPDATE_PLUGINS 1 \
|
||||||
--set DISABLE_INSTALLATION_CHECKS 1 \
|
--set DISABLE_INSTALLATION_CHECKS 1 \
|
||||||
--unset DEV \
|
--set USE_BUILTIN_RIPGREP 0 \
|
||||||
--prefix PATH : ${
|
--prefix PATH : ${
|
||||||
lib.makeBinPath (
|
lib.makeBinPath (
|
||||||
[
|
[
|
||||||
# claude-code uses [node-tree-kill](https://github.com/pkrumins/node-tree-kill) which requires procps's pgrep(darwin) or ps(linux)
|
# claude-code uses [node-tree-kill](https://github.com/pkrumins/node-tree-kill) which requires procps's pgrep(darwin) or ps(linux)
|
||||||
procps
|
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)
|
# the following packages are required for the sandbox to work (Linux only)
|
||||||
++ lib.optionals stdenv.hostPlatform.isLinux [
|
++ lib.optionals stdenv.hostPlatform.isLinux [
|
||||||
|
|
@ -60,6 +71,8 @@ buildNpmPackage (finalAttrs: {
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
runHook postInstall
|
||||||
'';
|
'';
|
||||||
|
|
||||||
doInstallCheck = true;
|
doInstallCheck = true;
|
||||||
|
|
@ -68,23 +81,32 @@ buildNpmPackage (finalAttrs: {
|
||||||
versionCheckHook
|
versionCheckHook
|
||||||
];
|
];
|
||||||
versionCheckKeepEnvironment = [ "HOME" ];
|
versionCheckKeepEnvironment = [ "HOME" ];
|
||||||
|
versionCheckProgramArg = "--version";
|
||||||
|
|
||||||
passthru.updateScript = ./update.sh;
|
passthru.updateScript = ./update.sh;
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
description = "Agentic coding tool that lives in your terminal, understands your codebase, and helps you code faster";
|
description = "Agentic coding tool that lives in your terminal, understands your codebase, and helps you code faster";
|
||||||
homepage = "https://github.com/anthropics/claude-code";
|
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;
|
license = lib.licenses.unfree;
|
||||||
|
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
|
||||||
|
platforms = [
|
||||||
|
"aarch64-darwin"
|
||||||
|
"x86_64-darwin"
|
||||||
|
"aarch64-linux"
|
||||||
|
"x86_64-linux"
|
||||||
|
];
|
||||||
maintainers = with lib.maintainers; [
|
maintainers = with lib.maintainers; [
|
||||||
adeci
|
adeci
|
||||||
malo
|
malo
|
||||||
markus1189
|
markus1189
|
||||||
|
mirkolenz
|
||||||
omarjatoi
|
omarjatoi
|
||||||
oskarwires
|
oskarwires
|
||||||
xiaoxiangmoe
|
xiaoxiangmoe
|
||||||
];
|
];
|
||||||
mainProgram = "claude";
|
mainProgram = "claude";
|
||||||
sourceProvenance = with lib.sourceTypes; [ binaryBytecode ];
|
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,12 @@
|
||||||
#!/usr/bin/env nix
|
#!/usr/bin/env nix
|
||||||
#!nix shell --ignore-environment .#cacert .#nodejs .#git .#nix-update .#nix .#gnused .#findutils .#bash --command bash
|
#!nix shell --ignore-environment .#cacert .#coreutils .#curl .#bash --command bash
|
||||||
|
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
version=$(npm view @anthropic-ai/claude-code version)
|
cd "$(dirname "${BASH_SOURCE[0]}")"
|
||||||
|
|
||||||
# Update version and hashes
|
BASE_URL="https://storage.googleapis.com/claude-code-dist-86c565f3-f756-42ad-8dfa-d59b1c096819/claude-code-releases"
|
||||||
AUTHORIZED=1 NIXPKGS_ALLOW_UNFREE=1 nix-update claude-code --version="$version" --generate-lockfile
|
|
||||||
|
|
||||||
# nix-update can't update package-lock.json along with npmDepsHash
|
VERSION="${1:-$(curl -fsSL "$BASE_URL/latest")}"
|
||||||
# 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) \
|
curl -fsSL "$BASE_URL/$VERSION/manifest.json" --output manifest.json
|
||||||
| 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
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue