blob: 2a5ef4c603dc769b27175ab987b99fc604f28db9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
# https://github.com/NixOS/nixpkgs/blob/ffbc9f8cbaacfb331b6017d5a5abb21a492c9a38/pkgs/by-name/cl/claude-code/package.nix
# NOTE: Use the following command to update the package
# ```sh
# nix-shell maintainers/scripts/update.nix --argstr commit true --arg predicate '(path: pkg: builtins.elem path [["claude-code"] ["vscode-extensions" "anthropic" "claude-code"]])'
# ```
{
lib,
buildNpmPackage,
fetchzip,
writableTmpDirAsHomeHook,
versionCheckHook,
}:
buildNpmPackage (finalAttrs: {
pname = "claude-code";
version = "2.1.9";
src = fetchzip {
url = "https://registry.npmjs.org/@anthropic-ai/claude-code/-/claude-code-${finalAttrs.version}.tgz";
hash = "sha256-TU+54QVtcFaUErv8YB0NxmgP+0eUqa2JEjAVRHKPICs=";
};
npmDepsHash = "sha256-yZ5hFIqdKh6VYPGtdIaUq7CW9mnCyeFflr02laU8K0A=";
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" ];
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; [
adeci
malo
markus1189
omarjatoi
xiaoxiangmoe
];
mainProgram = "claude";
};
})
|