forked from raine/claude-code-proxy
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
80 lines (70 loc) · 2.1 KB
/
Copy pathflake.nix
File metadata and controls
80 lines (70 loc) · 2.1 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
{
description = "Anthropic-compatible proxy for Claude Code provider backends";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
};
outputs = { self, nixpkgs }:
let
cargoToml = builtins.fromTOML (builtins.readFile ./Cargo.toml);
systems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
forAllSystems = nixpkgs.lib.genAttrs systems;
in
{
packages = forAllSystems (system:
let
pkgs = nixpkgs.legacyPackages.${system};
in
{
default = pkgs.stdenv.mkDerivation {
pname = cargoToml.package.name;
version = cargoToml.package.version;
src = ./.;
nativeBuildInputs = with pkgs; [
cargo
rustc
];
buildPhase = ''
runHook preBuild
export CARGO_HOME="$TMPDIR/cargo-home"
cargo build --release --locked
runHook postBuild
'';
installPhase = ''
runHook preInstall
install -Dm755 target/release/claude-code-proxy "$out/bin/claude-code-proxy"
runHook postInstall
'';
meta = with pkgs.lib; {
description = cargoToml.package.description;
homepage = "https://github.com/raine/claude-code-proxy";
license = licenses.mit;
mainProgram = "claude-code-proxy";
};
};
}
);
apps = forAllSystems (system: {
default = {
type = "app";
program = "${self.packages.${system}.default}/bin/claude-code-proxy";
};
});
devShells = forAllSystems (system:
let
pkgs = nixpkgs.legacyPackages.${system};
in
{
default = pkgs.mkShell {
buildInputs = with pkgs; [
cargo
rustc
rust-analyzer
rustfmt
clippy
];
RUST_SRC_PATH = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}";
};
}
);
};
}