-
Notifications
You must be signed in to change notification settings - Fork 101
Expand file tree
/
Copy pathpackage.nix
More file actions
76 lines (67 loc) · 1.73 KB
/
package.nix
File metadata and controls
76 lines (67 loc) · 1.73 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
{
lib,
buildNpmPackage,
fetchurl,
fetchNpmDepsWithPackuments,
npmConfigHook,
fd,
ripgrep,
runCommand,
versionCheckHook,
versionCheckHomeHook,
}:
let
versionData = lib.importJSON ./hashes.json;
version = versionData.version;
# Create a source with package-lock.json included
srcWithLock = runCommand "pi-src-with-lock" { } ''
mkdir -p $out
tar -xzf ${
fetchurl {
url = "https://registry.npmjs.org/@mariozechner/pi-coding-agent/-/pi-coding-agent-${version}.tgz";
hash = versionData.sourceHash;
}
} -C $out --strip-components=1
cp ${./package-lock.json} $out/package-lock.json
'';
in
buildNpmPackage {
inherit npmConfigHook version;
pname = "pi";
src = srcWithLock;
npmDeps = fetchNpmDepsWithPackuments {
src = srcWithLock;
name = "pi-${version}-npm-deps";
hash = versionData.npmDepsHash;
cacheVersion = 2;
};
makeCacheWritable = true;
# The package from npm is already built
dontNpmBuild = true;
postInstall = ''
wrapProgram $out/bin/pi \
--prefix PATH : ${
lib.makeBinPath [
fd
ripgrep
]
} \
--set PI_SKIP_VERSION_CHECK 1
'';
doInstallCheck = true;
nativeInstallCheckInputs = [
versionCheckHook
versionCheckHomeHook
];
passthru.category = "AI Coding Agents";
meta = {
description = "A terminal-based coding agent with multi-model support";
homepage = "https://github.com/badlogic/pi-mono";
changelog = "https://github.com/badlogic/pi-mono/releases";
license = lib.licenses.mit;
sourceProvenance = with lib.sourceTypes; [ binaryBytecode ];
maintainers = with lib.maintainers; [ aos ];
platforms = lib.platforms.all;
mainProgram = "pi";
};
}