A declarative, hermetic harness for Nix-defined agents.
1# Package the tartarus harness from uv.lock via uv2nix.
2{
3 pkgs,
4 lib,
5 pyproject-nix,
6 uv2nix,
7 pyproject-build-systems,
8}:
9
10let
11 workspace = uv2nix.lib.workspace.loadWorkspace { workspaceRoot = ./.; };
12
13 python =
14 let
15 interpreters = pyproject-nix.lib.util.filterPythonInterpreters {
16 inherit (workspace) requires-python;
17 inherit (pkgs) pythonInterpreters;
18 };
19 in
20 if interpreters == [ ] then
21 throw "tartarus: no Python interpreter matches requires-python = \"${workspace.requires-python}\""
22 else
23 builtins.elemAt interpreters 0;
24
25 pythonSet = (pkgs.callPackage pyproject-nix.build.packages { inherit python; }).overrideScope (
26 lib.composeManyExtensions [
27 pyproject-build-systems.overlays.wheel
28 (workspace.mkPyprojectOverlay { sourcePreference = "wheel"; })
29 ]
30 );
31in
32(pythonSet.mkVirtualEnv "tartarus-env" workspace.deps.default).overrideAttrs (_: {
33 meta.mainProgram = "tartarus";
34})