-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
148 lines (130 loc) · 4.63 KB
/
flake.nix
File metadata and controls
148 lines (130 loc) · 4.63 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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
{
description = "Scape agent, protocol types, NixOS modules, and VM templates";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
natskell = {
url = "github:getmissionctrl/natskell/fix/msg-payload-framing";
inputs.nixpkgs.follows = "nixpkgs";
};
microvm = {
url = "github:microvm-nix/microvm.nix";
inputs.nixpkgs.follows = "nixpkgs";
};
llm-agents = {
url = "github:getmissionctrl/llm-agents.nix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, natskell, microvm, llm-agents, ... }:
let
system = "x86_64-linux";
pkgs = import nixpkgs { inherit system; };
# GHC 9.10 with natskell from source
hsPkgs = pkgs.haskell.packages.ghc910.override {
overrides = hfinal: hprev: {
natskell = pkgs.haskell.lib.doJailbreak
(hfinal.callCabal2nix "natskell" natskell {});
};
};
# scape-agents Haskell package
scapeAgentsPkg = pkgs.haskell.lib.overrideCabal
(hsPkgs.callCabal2nix "scape-agents" ./. {})
(old: {
librarySystemDepends = (old.librarySystemDepends or []) ++ [ pkgs.zlib ];
testToolDepends = (old.testToolDepends or []) ++ [ pkgs.nats-server ];
});
# ZeroClaw web UI — React SPA + Hono server, built from packages/ workspace
zeroclawUiPkg = pkgs.buildNpmPackage {
pname = "zeroclaw-ui";
version = "0.1.0";
src = ./packages;
npmDepsHash = "sha256-zzn9KjPakn0hD5VflD2/Rv1wOvv6Wg/Iw49ykUJ3RjQ=";
buildPhase = ''
runHook preBuild
npm run build --workspace=zeroclaw-ui
runHook postBuild
'';
installPhase = ''
runHook preInstall
mkdir -p $out/dist
cp -r zeroclaw-ui/dist/client $out/dist/
cp -r zeroclaw-ui/dist/server $out/dist/
runHook postInstall
'';
};
# Build a template as a NixOS microVM configuration
mkTemplate = name: nixpkgs.lib.nixosSystem {
inherit system;
specialArgs = { inherit self llm-agents; };
modules = [
microvm.nixosModules.microvm
./templates/${name}/default.nix
];
};
in {
nixosModules = {
# Agent-only mode: for inside VMs
agent = { lib, ... }: {
imports = [
./modules/agent.nix
./modules/template.nix
];
services.scape.agent.package = lib.mkDefault scapeAgentsPkg;
};
# Base microVM configuration
base-vm = ./modules/base-vm.nix;
};
# NixOS configurations for each template (microVM systems)
nixosConfigurations = {
debug = mkTemplate "debug";
python-sandbox = mkTemplate "python-sandbox";
duckdb-analyst = mkTemplate "duckdb-analyst";
openclaw = mkTemplate "openclaw";
openoutreach = mkTemplate "openoutreach";
};
packages.${system} = {
default = scapeAgentsPkg;
scape-agents = scapeAgentsPkg;
zeroclaw-ui = zeroclawUiPkg;
# MicroVM runners (what `nix build .#debug` produces)
debug = self.nixosConfigurations.debug.config.microvm.declaredRunner;
python-sandbox = self.nixosConfigurations.python-sandbox.config.microvm.declaredRunner;
duckdb-analyst = self.nixosConfigurations.duckdb-analyst.config.microvm.declaredRunner;
openclaw = self.nixosConfigurations.openclaw.config.microvm.declaredRunner;
openoutreach = self.nixosConfigurations.openoutreach.config.microvm.declaredRunner;
};
# Template flake outputs for `nix flake init`
templates = {
python-sandbox = {
path = ./templates/python-sandbox;
description = "Python sandbox with pip";
};
duckdb-analyst = {
path = ./templates/duckdb-analyst;
description = "DuckDB analyst with Python and data tools";
};
debug = {
path = ./templates/debug;
description = "Debug template with SSH and verbose logging";
};
openclaw = {
path = ./templates/openclaw;
description = "OpenClaw AI assistant with gateway web service";
};
openoutreach = {
path = ./templates/openoutreach;
description = "OpenOutreach LinkedIn automation daemon with VNC";
};
};
devShells.${system}.default = hsPkgs.shellFor {
packages = p: [ scapeAgentsPkg ];
nativeBuildInputs = with pkgs; [
cabal-install
hsPkgs.haskell-language-server
pkg-config
zlib.dev
nats-server
];
};
};
}