claude-code: add version check
This commit is contained in:
@@ -3,16 +3,18 @@
|
||||
buildNpmPackage,
|
||||
fetchzip,
|
||||
nodejs_20,
|
||||
writableTmpDirAsHomeHook,
|
||||
versionCheckHook,
|
||||
}:
|
||||
|
||||
buildNpmPackage rec {
|
||||
buildNpmPackage (finalAttrs: {
|
||||
pname = "claude-code";
|
||||
version = "1.0.126";
|
||||
|
||||
nodejs = nodejs_20; # required for sandboxed Nix builds on Darwin
|
||||
|
||||
src = fetchzip {
|
||||
url = "https://registry.npmjs.org/@anthropic-ai/claude-code/-/claude-code-${version}.tgz";
|
||||
url = "https://registry.npmjs.org/@anthropic-ai/claude-code/-/claude-code-${finalAttrs.version}.tgz";
|
||||
hash = "sha256-U6uYRkmVqMoJDAAzLHpF9G5OglPhLqPuwe6gWMQPx78=";
|
||||
};
|
||||
|
||||
@@ -24,7 +26,7 @@ buildNpmPackage rec {
|
||||
|
||||
dontNpmBuild = true;
|
||||
|
||||
AUTHORIZED = "1";
|
||||
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
|
||||
@@ -35,6 +37,14 @@ buildNpmPackage rec {
|
||||
--unset DEV
|
||||
'';
|
||||
|
||||
doInstallCheck = true;
|
||||
nativeInstallCheckInputs = [
|
||||
writableTmpDirAsHomeHook
|
||||
versionCheckHook
|
||||
];
|
||||
versionCheckKeepEnvironment = [ "HOME" ];
|
||||
versionCheckProgramArg = "--version";
|
||||
|
||||
passthru.updateScript = ./update.sh;
|
||||
|
||||
meta = {
|
||||
@@ -50,4 +60,4 @@ buildNpmPackage rec {
|
||||
];
|
||||
mainProgram = "claude";
|
||||
};
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user