feat: add claude-code package
- Add Nix package for @anthropic-ai/claude-code (v2.1.59) - Add package-lock.json with optional dependencies for all platforms - Include update script for automated version updates - Add module integration with custom package reference - Rename claude shell alias to claude-custom Refs: https://github.com/anthropics/claude-code
This commit is contained in:
61
packages/claude-code/default.nix
Normal file
61
packages/claude-code/default.nix
Normal file
@@ -0,0 +1,61 @@
|
||||
{ lib
|
||||
, buildNpmPackage
|
||||
, fetchzip
|
||||
, writableTmpDirAsHomeHook
|
||||
, versionCheckHook
|
||||
,
|
||||
}:
|
||||
buildNpmPackage (finalAttrs: {
|
||||
pname = "claude-code";
|
||||
version = "2.1.59";
|
||||
|
||||
src = fetchzip {
|
||||
url = "https://registry.npmjs.org/@anthropic-ai/claude-code/-/claude-code-${finalAttrs.version}.tgz";
|
||||
hash = "sha256-Dam9aJ0qBdqU40ACfzGQHuytW6ur0fMLm8D5fIKd1TE=";
|
||||
};
|
||||
|
||||
npmDepsHash = "sha256-K+8xoBc3apvxQ9hCpYywqgBcfLxMWSxacgJcMH8mK7E=";
|
||||
|
||||
strictDeps = true;
|
||||
|
||||
postPatch = ''
|
||||
cp ${./package-lock.json} package-lock.json
|
||||
'';
|
||||
|
||||
dontNpmBuild = true;
|
||||
|
||||
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
|
||||
# The DEV=true env var causes claude to crash with `TypeError: window.WebSocket is not a constructor`
|
||||
postInstall = ''
|
||||
wrapProgram $out/bin/claude \
|
||||
--set DISABLE_AUTOUPDATER 1 \
|
||||
--unset DEV
|
||||
'';
|
||||
|
||||
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://www.npmjs.com/package/@anthropic-ai/claude-code";
|
||||
license = lib.licenses.unfree;
|
||||
maintainers = with lib.maintainers; [
|
||||
malo
|
||||
markus1189
|
||||
omarjatoi
|
||||
xiaoxiangmoe
|
||||
];
|
||||
mainProgram = "claude";
|
||||
};
|
||||
})
|
||||
Reference in New Issue
Block a user