-
Notifications
You must be signed in to change notification settings - Fork 132
Expand file tree
/
Copy pathpackage.nix
More file actions
65 lines (54 loc) · 1.58 KB
/
package.nix
File metadata and controls
65 lines (54 loc) · 1.58 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
{
lib,
fetchurl,
buildNpmPackage,
makeWrapper,
ripgrep,
runCommand,
}:
let
versionData = lib.importJSON ./hashes.json;
version = versionData.version;
# Create a source with the vendored package-lock.json included
srcWithLock = runCommand "iflow-cli-src-with-lock" { } ''
mkdir -p $out
tar -xzf ${
fetchurl {
url = "https://registry.npmjs.org/@iflow-ai/iflow-cli/-/iflow-cli-${version}.tgz";
hash = versionData.sourceHash;
}
} -C $out --strip-components=1
cp ${./package-lock.json} $out/package-lock.json
'';
in
buildNpmPackage {
npmDepsFetcherVersion = 2;
inherit version;
pname = "iflow-cli";
src = srcWithLock;
npmDepsHash = versionData.npmDepsHash;
makeCacheWritable = true;
postPatch = ''
# Disable auto-update: replace `process.env.DEV==="true"` with `true` in ybt()
substituteInPlace bundle/iflow.js \
--replace-fail 'process.env.DEV==="true"' 'true'
'';
npmFlags = [ "--ignore-scripts" ];
nativeBuildInputs = [ makeWrapper ];
dontNpmBuild = true;
postInstall = ''
wrapProgram $out/bin/iflow \
--set USE_BUILTIN_RIPGREP 0 \
--prefix PATH : ${lib.makeBinPath [ ripgrep ]}
'';
passthru.category = "AI Coding Agents";
meta = {
description = "AI coding agent for the terminal with free model access via the iFlow platform";
homepage = "https://github.com/iflow-ai/iflow-cli";
license = lib.licenses.asl20;
sourceProvenance = with lib.sourceTypes; [ binaryBytecode ];
mainProgram = "iflow";
platforms = lib.platforms.all;
maintainers = [ ];
};
}