Repository navigation
Expand file tree
/
Copy pathflake.nix
More file actions
175 lines (173 loc) · 6 KB
/
Copy pathflake.nix
File metadata and controls
175 lines (173 loc) · 6 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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
{
description = "Local LangGraph workflows with pluggable model backends";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
pyproject-nix = {
url = "github:pyproject-nix/pyproject.nix";
inputs.nixpkgs.follows = "nixpkgs";
};
uv2nix = {
url = "github:pyproject-nix/uv2nix";
inputs.pyproject-nix.follows = "pyproject-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
pyproject-build-systems = {
url = "github:pyproject-nix/build-system-pkgs";
inputs.pyproject-nix.follows = "pyproject-nix";
inputs.uv2nix.follows = "uv2nix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs =
inputs:
let
inherit (inputs)
self
nixpkgs
pyproject-nix
uv2nix
pyproject-build-systems
;
inherit (nixpkgs) lib;
systems = [
"aarch64-darwin"
"aarch64-linux"
"x86_64-linux"
];
forAllSystems = lib.genAttrs systems;
pkgsFor =
system:
import nixpkgs {
inherit system;
config.allowUnfreePredicate =
package:
builtins.elem (lib.getName package) [
"cursor-cli"
"claude-code"
];
};
workspace = uv2nix.lib.workspace.loadWorkspace { workspaceRoot = ./.; };
overlay = workspace.mkPyprojectOverlay { sourcePreference = "wheel"; };
pythonSets = forAllSystems (
system:
let
pkgs = pkgsFor system;
in
(pkgs.callPackage pyproject-nix.build.packages { python = pkgs.python313; }).overrideScope (
lib.composeManyExtensions [
pyproject-build-systems.overlays.wheel
overlay
]
)
);
runtimes = forAllSystems (
system: pythonSets.${system}.mkVirtualEnv "lambda-harness-runtime" workspace.deps.default
);
development = forAllSystems (
system: pythonSets.${system}.mkVirtualEnv "lambda-harness-development" workspace.deps.all
);
in
{
packages = forAllSystems (
system:
let
pkgs = pkgsFor system;
in
{
default = pkgs.writeShellApplication {
name = "lambda-harness-web";
runtimeInputs = [
pkgs.git
pkgs.gh
pkgs.lychee
pkgs.nix
pkgs.cursor-cli
pkgs.codex
pkgs.claude-code
];
text = ''exec ${runtimes.${system}}/bin/python -m lambda_harness "$@"'';
};
}
);
apps = forAllSystems (system: {
default = {
type = "app";
program = "${self.packages.${system}.default}/bin/lambda-harness-web";
meta.description = "Start the Lambda Harness local website";
};
});
devShells = forAllSystems (
system:
let
pkgs = pkgsFor system;
in
{
default = pkgs.mkShell {
packages = [
development.${system}
pkgs.git
pkgs.gh
pkgs.lychee
pkgs.just
pkgs.nixfmt
pkgs.nodejs
pkgs.prettier
pkgs.uv
pkgs.cursor-cli
pkgs.codex
pkgs.claude-code
];
UV_PYTHON_DOWNLOADS = "never";
UV_NO_SYNC = "1";
shellHook = ''export PYTHONPATH="$PWD/src"'';
};
}
);
checks = forAllSystems (
system:
let
pkgs = nixpkgs.legacyPackages.${system};
in
{
website = pkgs.runCommand "lambda-harness-website-check" { } ''
${self.packages.${system}.default}/bin/lambda-harness-web --help > help.txt
${runtimes.${system}}/bin/python -c 'from importlib.resources import files; root = files("lambda_harness").joinpath("web"); assert "Stop model" in root.joinpath("index.html").read_text(); assert "Project memory" in root.joinpath("guide.html").read_text(); assert "agent-grid" in root.joinpath("index.html").read_text(); assert files("lambda_harness").joinpath("agents", "rust-reviewer.json").is_file()'
${runtimes.${system}}/bin/python -c 'from importlib.metadata import distribution; assert not distribution("lambda-harness").entry_points'
${runtimes.${system}}/bin/python -c 'from lambda_harness.backends import prompt_for; from lambda_harness.agent_library import AgentLibrary; from pathlib import Path; import tempfile; prompt_for("documentation_reviewer", {}); library = AgentLibrary(Path(tempfile.mkdtemp())); assert library.get("default-documentation-reviewer")["definition"]["role"] == "documentation_reviewer"; library.close()'
${pkgs.codex}/bin/codex --ask-for-approval never exec --sandbox read-only --color never --ephemeral --ignore-user-config --ignore-rules - --help > codex-help.txt
touch "$out"
'';
harness =
pkgs.runCommand "lambda-harness-check"
{
nativeBuildInputs = [
development.${system}
pkgs.git
pkgs.lychee
pkgs.nixfmt
pkgs.nodejs
pkgs.prettier
];
}
''
export HOME="$TMPDIR/home"
mkdir -p "$HOME"
cp -r ${./.} source
chmod -R u+w source
cd source
export PYTHONPATH="$PWD/src"
ruff check .
ruff format --check .
nixfmt --check flake.nix
prettier --check src/lambda_harness/web tests/web.test.cjs
node --check src/lambda_harness/web/app.js
node --check src/lambda_harness/web/theme.js
node --test tests/web.test.cjs
pytest -q
touch "$out"
'';
}
);
formatter = forAllSystems (system: nixpkgs.legacyPackages.${system}.nixfmt);
};
}