From 880ca65b0a58544166c0ed8114c27a61533273d5 Mon Sep 17 00:00:00 2001 From: Patrick Hobusch Date: Wed, 29 Apr 2026 17:10:31 +0800 Subject: [PATCH] vscode-extensions.anthropic.claude-code: fix bundled binary on NixOS The bundled `claude` binary shipped with #513902 is a dynamically-linked ELF and does not run on NixOS without patching. Run `autoPatchelfHook` on Linux, and add a passthru test that executes the bundled binary so that this kind of regression is caught. I missed this because I didn't test it locally. --- .../anthropic.claude-code/default.nix | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 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 7cfd9a85a96e..a79407bb7f1b 100644 --- a/pkgs/applications/editors/vscode/extensions/anthropic.claude-code/default.nix +++ b/pkgs/applications/editors/vscode/extensions/anthropic.claude-code/default.nix @@ -1,10 +1,21 @@ { lib, + stdenv, stdenvNoCC, + autoPatchelfHook, + alsa-lib, + testers, vscode-utils, }: -vscode-utils.buildVscodeMarketplaceExtension { +vscode-utils.buildVscodeMarketplaceExtension (finalAttrs: { + nativeBuildInputs = lib.optionals stdenv.hostPlatform.isLinux [ autoPatchelfHook ]; + + buildInputs = lib.optionals stdenv.hostPlatform.isLinux [ + (lib.getLib stdenv.cc.cc) + alsa-lib + ]; + mktplcRef = let sources = { @@ -34,6 +45,11 @@ vscode-utils.buildVscodeMarketplaceExtension { // sources.${stdenvNoCC.hostPlatform.system} or (throw "Unsupported system ${stdenvNoCC.hostPlatform.system}"); + passthru.tests.bundled-claude-runs = testers.testVersion { + package = finalAttrs.finalPackage; + command = "${finalAttrs.finalPackage}/share/vscode/extensions/anthropic.claude-code/resources/native-binary/claude --version"; + }; + meta = { description = "Harness the power of Claude Code without leaving your IDE"; homepage = "https://docs.anthropic.com/s/claude-code"; @@ -48,4 +64,4 @@ vscode-utils.buildVscodeMarketplaceExtension { "aarch64-darwin" ]; }; -} +})