diff options
| author | nsfisis <nsfisis@gmail.com> | 2025-10-05 13:27:27 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2025-10-05 13:27:27 +0900 |
| commit | 77d541e3340703982f4bd79bc241c573f9528607 (patch) | |
| tree | 108e4594508dc25c2709c176c2c9ecb8f09ede70 /pkgs | |
| parent | 7c0f415a08bdb17a0c057e5d99d1498ef51455f4 (diff) | |
| download | nur-packages-77d541e3340703982f4bd79bc241c573f9528607.tar.gz nur-packages-77d541e3340703982f4bd79bc241c573f9528607.tar.zst nur-packages-77d541e3340703982f4bd79bc241c573f9528607.zip | |
feat(claude-code): update
Diffstat (limited to 'pkgs')
| -rw-r--r-- | pkgs/claude-code/default.nix | 28 | ||||
| -rw-r--r-- | pkgs/claude-code/package-lock.json | 12 | ||||
| -rwxr-xr-x | pkgs/claude-code/update.sh | 13 |
3 files changed, 25 insertions, 28 deletions
diff --git a/pkgs/claude-code/default.nix b/pkgs/claude-code/default.nix index ef55886..7cee1dd 100644 --- a/pkgs/claude-code/default.nix +++ b/pkgs/claude-code/default.nix @@ -1,24 +1,22 @@ -# https://github.com/NixOS/nixpkgs/blob/6027c30c8e9810896b92429f0092f624f7b1aace/pkgs/by-name/cl/claude-code/package.nix +# https://github.com/NixOS/nixpkgs/blob/7df7ff7d8e00218376575f0acdcc5d66741351ee/pkgs/by-name/cl/claude-code/package.nix { lib, buildNpmPackage, fetchzip, - nodejs_20, + writableTmpDirAsHomeHook, + versionCheckHook, }: - -buildNpmPackage rec { +buildNpmPackage (finalAttrs: { pname = "claude-code"; version = "2.0.1"; - nodejs = nodejs_20; # required for sandboxed Nix builds on Darwin - src = fetchzip { - url = "https://registry.npmjs.org/@anthropic-ai/claude-code/-/claude-code-${version}.tgz"; + url = "https://registry.npmjs.org/@anthropic-ai/claude-code/-/claude-code-${finalAttrs.version}.tgz"; hash = "sha256-LUbDPFa0lY74MBU4hvmYVntt6hVZy6UUZFN0iB4Eno8="; }; - npmDepsHash = "sha256-mxMEO1r5KzHw7d3NRJSWtkc9vnnd5XbgD2D5MYP1zO0="; + npmDepsHash = "sha256-DehkeMZvzn+hvcCDzJfd4p9oYc1GSZm8gu8vKS4Uncw="; postPatch = '' cp ${./package-lock.json} package-lock.json @@ -26,7 +24,7 @@ buildNpmPackage rec { dontNpmBuild = true; - AUTHORIZED = "1"; + 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 @@ -37,6 +35,14 @@ buildNpmPackage rec { --unset DEV ''; + doInstallCheck = true; + nativeInstallCheckInputs = [ + writableTmpDirAsHomeHook + versionCheckHook + ]; + versionCheckKeepEnvironment = [ "HOME" ]; + versionCheckProgramArg = "--version"; + passthru.updateScript = ./update.sh; meta = { @@ -46,8 +52,10 @@ buildNpmPackage rec { license = lib.licenses.unfree; maintainers = with lib.maintainers; [ malo + markus1189 omarjatoi + xiaoxiangmoe ]; mainProgram = "claude"; }; -} +}) diff --git a/pkgs/claude-code/package-lock.json b/pkgs/claude-code/package-lock.json index 1605898..4c777b7 100644 --- a/pkgs/claude-code/package-lock.json +++ b/pkgs/claude-code/package-lock.json @@ -1,18 +1,12 @@ { - "name": "claude-code", - "version": "1.0.17", + "name": "@anthropic-ai/claude-code", + "version": "2.0.1", "lockfileVersion": 3, "requires": true, "packages": { "": { - "dependencies": { - "@anthropic-ai/claude-code": "^2.0.1" - } - }, - "node_modules/@anthropic-ai/claude-code": { + "name": "@anthropic-ai/claude-code", "version": "2.0.1", - "resolved": "https://registry.npmjs.org/@anthropic-ai/claude-code/-/claude-code-2.0.1.tgz", - "integrity": "sha512-2SboYcdJ+dsE2K784dbJ4ohVWlAkLZhU7mZG1lebyG6TvGLXLhjc2qTEfCxSeelCjJHhIh/YkNpe06veB4IgBw==", "license": "SEE LICENSE IN README.md", "bin": { "claude": "cli.js" diff --git a/pkgs/claude-code/update.sh b/pkgs/claude-code/update.sh index ede1f43..4d0d1f9 100755 --- a/pkgs/claude-code/update.sh +++ b/pkgs/claude-code/update.sh @@ -1,17 +1,12 @@ #!/usr/bin/env nix-shell -#!nix-shell -i bash -p nodePackages.npm nix-update +#!nix-shell --pure -i bash --packages nodejs nix-update git -# https://github.com/NixOS/nixpkgs/blob/3016b4b15d13f3089db8a41ef937b13a9e33a8df/pkgs/by-name/cl/claude-code/update.sh +# https://github.com/NixOS/nixpkgs/blob/7df7ff7d8e00218376575f0acdcc5d66741351ee/pkgs/by-name/cl/claude-code/update.sh set -euo pipefail version=$(npm view @anthropic-ai/claude-code version) -# Generate updated lock file -cd "$(dirname "${BASH_SOURCE[0]}")" -npm i --package-lock-only @anthropic-ai/claude-code@"$version" -rm -f package.json - # Update version and hashes -cd - -nix-update claude-code --version "$version" +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" |
