-
Notifications
You must be signed in to change notification settings - Fork 103
Expand file tree
/
Copy pathpackage.nix
More file actions
53 lines (43 loc) · 1.38 KB
/
package.nix
File metadata and controls
53 lines (43 loc) · 1.38 KB
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
{
lib,
stdenv,
fetchzip,
nodejs,
}:
let
versionData = builtins.fromJSON (builtins.readFile ./hashes.json);
inherit (versionData) version hash;
in
stdenv.mkDerivation {
pname = "claude-code-router";
inherit version;
src = fetchzip {
url = "https://registry.npmjs.org/@musistudio/claude-code-router/-/claude-code-router-${version}.tgz";
inherit hash;
};
nativeBuildInputs = [ nodejs ];
installPhase = ''
runHook preInstall
# The npm package already contains built files
mkdir -p $out/bin
cp $src/dist/cli.js $out/bin/ccr
chmod +x $out/bin/ccr
# Replace the shebang with the correct node path
substituteInPlace $out/bin/ccr \
--replace-quiet "#!/usr/bin/env node" "#!${nodejs}/bin/node"
# Install the WASM file in the same directory as the CLI
cp $src/dist/tiktoken_bg.wasm $out/bin/
runHook postInstall
'';
passthru.category = "Claude Code Ecosystem";
meta = with lib; {
description = "Use Claude Code without an Anthropics account and route it to another LLM provider";
homepage = "https://github.com/musistudio/claude-code-router";
changelog = "https://github.com/musistudio/claude-code-router/releases";
license = licenses.mit;
sourceProvenance = with lib.sourceTypes; [ binaryBytecode ];
maintainers = with maintainers; [ ];
mainProgram = "ccr";
platforms = platforms.all;
};
}