-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
123 lines (98 loc) · 3.24 KB
/
flake.nix
File metadata and controls
123 lines (98 loc) · 3.24 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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
{
description = "vers-agent - ACP-compliant AI agent harness with interactive CLI";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
};
# Build vers-agent package
vers-agent = pkgs.stdenv.mkDerivation {
pname = "vers-agent";
version = "0.1.0";
src = pkgs.lib.cleanSource ./.;
nativeBuildInputs = with pkgs; [
bun
nodejs_22
makeWrapper
cacert
];
# Required for bun install to work
SSL_CERT_FILE = "${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt";
HOME = "/tmp/bun-build-home";
# Allow network access for fetching dependencies
__noChroot = true;
buildPhase = ''
runHook preBuild
mkdir -p $HOME
# Install dependencies
bun install --frozen-lockfile
# Bundle to JS (bun compile doesn't work well in Nix)
bun build --target=bun --minify --external cpu-features ./index.ts --outdir=dist
runHook postBuild
'';
installPhase = ''
runHook preInstall
mkdir -p $out/lib/vers-agent $out/bin
# Copy bundled JS
cp dist/index.js $out/lib/vers-agent/
# Create wrapper script that uses bun
makeWrapper ${pkgs.bun}/bin/bun $out/bin/vers-agent \
--add-flags "$out/lib/vers-agent/index.js"
runHook postInstall
'';
meta = with pkgs.lib; {
description = "ACP-compliant AI agent harness with interactive CLI";
homepage = "https://github.com/hdresearch/vers-agent";
license = licenses.mit;
maintainers = [ ];
platforms = platforms.unix;
};
};
in
{
packages = {
default = vers-agent;
vers-agent = vers-agent;
};
# Development shell with all tools needed
devShells.default = pkgs.mkShell {
buildInputs = with pkgs; [
# Runtime
bun
nodejs_22
# Build tools
just
typescript
# Utilities
jq
curl
];
shellHook = ''
echo "vers-agent development environment"
echo ""
echo "Available commands:"
echo " just install - Install dependencies and git hooks"
echo " just dev - Run with hot reload"
echo " just build - Build standalone executable"
echo " just test - Run tests"
echo " just check - Run typecheck and tests"
echo ""
# Set up git hooks if in a git repo
if [ -d .git ]; then
just setup-hooks 2>/dev/null || true
fi
'';
};
# For running directly: nix run .#
apps.default = {
type = "app";
program = "${vers-agent}/bin/vers-agent";
};
}
);
}