OOKNET                             [ /  search the index  ]  
──────────────────────────────────────────────────────────────────────────────────────
══════════════════════════════════════════════════════════════════════════════════════
OOKNET   [ /  search  ]  
────────────────────────────────────────────────
════════════════════════════════════════════════
 
 
main @ 102 LINES
 
[ HISTORY ]  [ UP ]
 

{
  lib,
  stdenvNoCC,
  fetchurl,
  installShellFiles,
  makeBinaryWrapper,
  autoPatchelfHook,
  alsa-lib,
  procps,
  ripgrep,
  bubblewrap,
  socat,
  versionCheckHook,
  writableTmpDirAsHomeHook,
}: let
  stdenv = stdenvNoCC;
  baseUrl = "https://storage.googleapis.com/claude-code-dist-86c565f3-f756-42ad-8d
fa-d59b1c096819/claude-code-releases";
  manifest = lib.importJSON ./manifest.json;
  platformKey = "${stdenv.hostPlatform.node.platform}-${stdenv.hostPlatform.node.a
rch}";
  platformManifestEntry = manifest.platforms.${platformKey};
in
  stdenv.mkDerivation (finalAttrs: {
    pname = "claude-code";
    inherit (manifest) version;

    src = fetchurl {
      url = "${baseUrl}/${finalAttrs.version}/${platformKey}/claude";
      sha256 = platformManifestEntry.checksum;
    };

    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;

    installPhase = ''
      runHook preInstall

      installBin $src

      wrapProgram $out/bin/claude \
        --set DISABLE_AUTOUPDATER 1 \
        --set-default FORCE_AUTOUPDATE_PLUGINS 1 \
        --set DISABLE_INSTALLATION_CHECKS 1 \
        --set USE_BUILTIN_RIPGREP 0 \
        ${lib.optionalString stdenv.hostPlatform.isLinux ''
        --prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [alsa-lib]} \
      ''}--prefix PATH : ${
        lib.makeBinPath (
          [
            # claude-code uses [node-tree-kill](https://github.com/pkrumins/node-t
ree-kill) which requires procps's pgrep(darwin) or ps(linux)
            procps
            # https://code.claude.com/docs/en/troubleshooting#search-and-discovery
-issues
            ripgrep
          ]
          # the following packages are required for the sandbox to work (Linux onl
y)
          ++ lib.optionals stdenv.hostPlatform.isLinux [
            bubblewrap
            socat
          ]
        )
      }

      runHook postInstall
    '';

    doInstallCheck = true;
    nativeInstallCheckInputs = [
      writableTmpDirAsHomeHook
      versionCheckHook
    ];
    versionCheckKeepEnvironment = ["HOME"];
    versionCheckProgramArg = "--version";

    passthru.updateScript = ./update.sh;

    meta = {
      description = "Agentic coding tool that lives in your terminal, understands 
your codebase, and helps you code faster";
      homepage = "https://github.com/anthropics/claude-code";
      downloadPage = "https://claude.com/product/claude-code";
      changelog = "https://github.com/anthropics/claude-code/blob/main/CHANGELOG.m
d";
      sourceProvenance = with lib.sourceTypes; [binaryNativeCode];
      platforms = [
        "aarch64-darwin"
        "x86_64-darwin"
        "aarch64-linux"
        "x86_64-linux"
      ];
      mainProgram = "claude";
    };
  })

{
  lib,
  stdenvNoCC,
  fetchurl,
  installShellFiles,
  makeBinaryWrapper,
  autoPatchelfHook,
  alsa-lib,
  procps,
  ripgrep,
  bubblewrap,
  socat,
  versionCheckHook,
  writableTmpDirAsHomeHook,
}: let
  stdenv = stdenvNoCC;
  baseUrl = "https://storage.googleapis.com/
claude-code-dist-86c565f3-f756-42ad-8dfa-d59
b1c096819/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";
    inherit (manifest) version;

    src = fetchurl {
      url = "${baseUrl}/${finalAttrs.version
}/${platformKey}/claude";
      sha256 = platformManifestEntry.checksu
m;
    };

    dontUnpack = true;
    dontBuild = true;
    __noChroot = stdenv.hostPlatform.isDarwi
n;
    # otherwise the bun runtime is executed 
instead of the binary
    dontStrip = true;

    nativeBuildInputs =
      [
        installShellFiles
        makeBinaryWrapper
      ]
      ++ lib.optionals stdenv.hostPlatform.i
sElf [autoPatchelfHook];

    strictDeps = true;

    installPhase = ''
      runHook preInstall

      installBin $src

      wrapProgram $out/bin/claude \
        --set DISABLE_AUTOUPDATER 1 \
        --set-default FORCE_AUTOUPDATE_PLUGI
NS 1 \
        --set DISABLE_INSTALLATION_CHECKS 1 
\
        --set USE_BUILTIN_RIPGREP 0 \
        ${lib.optionalString stdenv.hostPlat
form.isLinux ''
        --prefix LD_LIBRARY_PATH : ${lib.mak
eLibraryPath [alsa-lib]} \
      ''}--prefix PATH : ${
        lib.makeBinPath (
          [
            # claude-code uses [node-tree-ki
ll](https://github.com/pkrumins/node-tree-ki
ll) which requires procps's pgrep(darwin) or
 ps(linux)
            procps
            # https://code.claude.com/docs/e
n/troubleshooting#search-and-discovery-issue
s
            ripgrep
          ]
          # the following packages are requi
red for the sandbox to work (Linux only)
          ++ lib.optionals stdenv.hostPlatfo
rm.isLinux [
            bubblewrap
            socat
          ]
        )
      }

      runHook postInstall
    '';

    doInstallCheck = true;
    nativeInstallCheckInputs = [
      writableTmpDirAsHomeHook
      versionCheckHook
    ];
    versionCheckKeepEnvironment = ["HOME"];
    versionCheckProgramArg = "--version";

    passthru.updateScript = ./update.sh;

    meta = {
      description = "Agentic coding tool tha
t lives in your terminal, understands your c
odebase, and helps you code faster";
      homepage = "https://github.com/anthrop
ics/claude-code";
      downloadPage = "https://claude.com/pro
duct/claude-code";
      changelog = "https://github.com/anthro
pics/claude-code/blob/main/CHANGELOG.md";
      sourceProvenance = with lib.sourceType
s; [binaryNativeCode];
      platforms = [
        "aarch64-darwin"
        "x86_64-darwin"
        "aarch64-linux"
        "x86_64-linux"
      ];
      mainProgram = "claude";
    };
  })
 
──────────────────────────────────────────────────────────────────────────────────────
OOKNET
────────────────────────────────────────────────
OOKNET