forked from numtide/llm-agents.nix
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpackage.nix
More file actions
96 lines (81 loc) · 2.09 KB
/
Copy pathpackage.nix
File metadata and controls
96 lines (81 loc) · 2.09 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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
{
lib,
stdenv,
fetchurl,
makeWrapper,
coreutils,
wrapBuddy,
versionCheckHook,
versionCheckHomeHook,
}:
let
pname = "cursor-agent";
versionData = builtins.fromJSON (builtins.readFile ./hashes.json);
inherit (versionData) version hashes;
platformMap = {
x86_64-linux = "linux/x64";
aarch64-linux = "linux/arm64";
x86_64-darwin = "darwin/x64";
aarch64-darwin = "darwin/arm64";
};
platform = stdenv.hostPlatform.system;
platformPath = platformMap.${platform} or (throw "Unsupported system: ${platform}");
src = fetchurl {
url = "https://downloads.cursor.com/lab/${version}/${platformPath}/agent-cli-package.tar.gz";
hash = hashes.${platform};
};
in
stdenv.mkDerivation rec {
inherit pname version src;
nativeBuildInputs = [
makeWrapper
]
++ lib.optionals stdenv.hostPlatform.isLinux [
wrapBuddy
];
doInstallCheck = true;
nativeInstallCheckInputs = [
versionCheckHook
versionCheckHomeHook
];
buildInputs = lib.optionals stdenv.hostPlatform.isLinux [
stdenv.cc.cc.lib
];
unpackPhase = ''
runHook preUnpack
tar -xzf $src
runHook postUnpack
'';
installPhase = ''
runHook preInstall
# Copy the dist-package contents
mkdir -p $out
cp -r dist-package/* $out/
# Ensure binaries are executable
chmod +x $out/cursor-agent
chmod +x $out/node
chmod +x $out/rg
# Create a wrapper in bin directory
mkdir -p $out/bin
makeWrapper $out/cursor-agent $out/bin/cursor-agent \
--prefix PATH : $out \
--prefix PATH : ${coreutils}/bin
runHook postInstall
'';
passthru.category = "AI Coding Agents";
meta = with lib; {
description = "Cursor Agent - CLI tool for Cursor AI code editor";
homepage = "https://cursor.com/";
changelog = "https://www.cursor.com/changelog";
license = licenses.unfree;
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
maintainers = with maintainers; [ ];
platforms = [
"x86_64-linux"
"aarch64-linux"
"x86_64-darwin"
"aarch64-darwin"
];
mainProgram = "cursor-agent";
};
}