From 652adc674a292f632d4370d90c3148bafdf96341 Mon Sep 17 00:00:00 2001 From: Patrick Hobusch Date: Mon, 27 Apr 2026 15:56:40 +0800 Subject: [PATCH] vscode-extensions.anthropic.claude-code: use platform-specific VSIXs The marketplace ships a separate VSIX per target platform, each bundling the matching `claude` native binary. Switch to the standard nixpkgs platform-specific pattern via `mktplcRef.arch`, and drop the `claude-code` input plus the `postInstall` symlink. The previous mechanism (#478565) fetches an unqualified VSIX and replaces its bundled `claude` with a symlink to the `claude-code` package. This risks extension/CLI version drift, and the marketplace serves different per-platform artifacts for the unqualified URL, so the fixed-output hash fails on platforms other than the one it was originally computed on. --- .../anthropic.claude-code/default.nix | 48 ++++++++++++++----- 1 file changed, 35 insertions(+), 13 deletions(-) diff --git a/pkgs/applications/editors/vscode/extensions/anthropic.claude-code/default.nix b/pkgs/applications/editors/vscode/extensions/anthropic.claude-code/default.nix index 716c717ea6b4..b4868742f542 100644 --- a/pkgs/applications/editors/vscode/extensions/anthropic.claude-code/default.nix +++ b/pkgs/applications/editors/vscode/extensions/anthropic.claude-code/default.nix @@ -1,22 +1,38 @@ { lib, - claude-code, + stdenvNoCC, vscode-utils, }: vscode-utils.buildVscodeMarketplaceExtension { - mktplcRef = { - name = "claude-code"; - publisher = "anthropic"; - version = "2.1.119"; - hash = "sha256-/KqOJ8dvv6PhQJyfuOFEgKx6U8hH/WoUnocmWxsLLUk="; - }; - - postInstall = '' - mkdir -p "$out/$installPrefix/resources/native-binary" - rm -f "$out/$installPrefix/resources/native-binary/claude"* - ln -s "${claude-code}/bin/claude" "$out/$installPrefix/resources/native-binary/claude" - ''; + mktplcRef = + let + sources = { + "x86_64-linux" = { + arch = "linux-x64"; + hash = "sha256-w4kUYNnQW4KkIlzxnTASTBFxL3m3/NBwBET7/8ealIY="; + }; + "aarch64-linux" = { + arch = "linux-arm64"; + hash = "sha256-ZsVR7Qajv78A0+UfR+DqaUZyV1FFRjNs2+vJInboh6U="; + }; + "x86_64-darwin" = { + arch = "darwin-x64"; + hash = "sha256-8zvhF5cs1XOGa/l2M27K2Mv2cgusNy51glFZf1OVdWI="; + }; + "aarch64-darwin" = { + arch = "darwin-arm64"; + hash = "sha256-Csb9F6HGWAgvPDjtsu35gjtGCuDLu0WQD1NNX/+S7F8="; + }; + }; + in + { + name = "claude-code"; + publisher = "anthropic"; + version = "2.1.119"; + } + // sources.${stdenvNoCC.hostPlatform.system} + or (throw "Unsupported system ${stdenvNoCC.hostPlatform.system}"); meta = { description = "Harness the power of Claude Code without leaving your IDE"; @@ -25,5 +41,11 @@ vscode-utils.buildVscodeMarketplaceExtension { license = lib.licenses.unfree; sourceProvenance = with lib.sourceTypes; [ binaryBytecode ]; maintainers = with lib.maintainers; [ xiaoxiangmoe ]; + platforms = [ + "x86_64-linux" + "aarch64-linux" + "x86_64-darwin" + "aarch64-darwin" + ]; }; }