-
Notifications
You must be signed in to change notification settings - Fork 103
Expand file tree
/
Copy pathpackage.nix
More file actions
91 lines (74 loc) · 2.09 KB
/
package.nix
File metadata and controls
91 lines (74 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
{
lib,
stdenv,
fetchurl,
makeWrapper,
wrapBuddy,
gcc-unwrapped,
versionCheckHook,
}:
let
versionData = builtins.fromJSON (builtins.readFile ./hashes.json);
inherit (versionData) version;
platformMap = {
x86_64-linux = "linux/x64";
aarch64-linux = "linux/arm64";
aarch64-darwin = "darwin/arm64";
};
platform = stdenv.hostPlatform.system;
platformPath = platformMap.${platform} or (throw "Unsupported system: ${platform}");
in
stdenv.mkDerivation {
pname = "droid";
inherit version;
src = fetchurl {
url = "https://downloads.factory.ai/factory-cli/releases/${version}/${platformPath}/droid";
hash = versionData.droid.${platform};
};
rgSrc = fetchurl {
url = "https://downloads.factory.ai/ripgrep/${platformPath}/rg";
hash = versionData.ripgrep.${platform};
};
nativeBuildInputs = [
makeWrapper
]
++ lib.optionals stdenv.hostPlatform.isLinux [
wrapBuddy
];
buildInputs = lib.optionals stdenv.hostPlatform.isLinux [
gcc-unwrapped.lib
];
dontUnpack = true;
dontStrip = true;
installPhase = ''
runHook preInstall
mkdir -p $out/bin
mkdir -p $out/lib/factory
# Install the main droid binary
install -Dm755 $src $out/bin/droid
# Install ripgrep for code search functionality
install -Dm755 $rgSrc $out/lib/factory/rg
# Wrap droid to ensure ripgrep is in PATH
wrapProgram $out/bin/droid \
--prefix PATH : $out/lib/factory
runHook postInstall
'';
doInstallCheck = true;
nativeInstallCheckInputs = [ versionCheckHook ];
passthru.category = "AI Coding Agents";
meta = with lib; {
description = "Factory AI's Droid - AI-powered development agent for your terminal";
homepage = "https://factory.ai";
changelog = "https://docs.factory.ai/changelog/cli-updates";
downloadPage = "https://factory.ai/product/ide";
license = licenses.unfree;
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
maintainers = with maintainers; [ ];
mainProgram = "droid";
platforms = [
"x86_64-linux"
"aarch64-linux"
"aarch64-darwin"
];
};
}