Commit 880ca65b authored by Patrick Hobusch's avatar Patrick Hobusch
Browse files

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.
parent 0e6d0d7a
Loading
Loading
Loading
Loading
+18 −2
Original line number Diff line number Diff line
{
  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"
    ];
  };
}
})