-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
133 lines (126 loc) · 4.73 KB
/
Copy pathflake.nix
File metadata and controls
133 lines (126 loc) · 4.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
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
{
description = "commy plugin — substrate-agnostic agent communications";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
# Reached only by `devShells.maintainer`. Nix fetches flake inputs per
# output, so `nix develop` and `nix develop .#ci` — everything a
# contributor and CI touch — never fetch, evaluate or build this. No
# `inputs.nixpkgs.follows`: beads needs Go 1.26 and this flake's nixpkgs
# carries 1.25.
beads.url = "github:gastownhall/beads/v1.1.2";
};
outputs =
{ nixpkgs, beads, ... }:
let
systems = [
"x86_64-linux"
"aarch64-linux"
"x86_64-darwin"
"aarch64-darwin"
];
forAllSystems =
f:
nixpkgs.lib.genAttrs systems (
system:
f {
inherit system;
pkgs = nixpkgs.legacyPackages.${system};
}
);
# Single source of truth for the plugin version — read from its pyproject
# so the flake and the package never drift.
pluginVersion =
(builtins.fromTOML (builtins.readFile ./clients/hermes/pyproject.toml)).project.version;
# The Hermes platform plugin (clients/hermes), built straight from the
# monorepo subdir as a pyproject package that exposes the
# `hermes_agent.plugins` entry point. Consumers add it to
# `services.hermes-agent.extraPythonPackages`; Hermes then discovers it via
# importlib.metadata and `hermes plugins enable commy-platform` activates
# it. `gateway` / `BasePlatformAdapter` come from the host Hermes at
# runtime, so there are no runtime deps and the Nix build neither imports
# nor tests the module — the repo gate (clients/hermes/scripts/test.sh)
# does that against a real `hermes-agent`.
commyHermesPlugin =
pythonPackages:
pythonPackages.buildPythonPackage {
pname = "commy-hermes";
version = pluginVersion;
pyproject = true;
src = nixpkgs.lib.cleanSourceWith {
src = ./clients/hermes;
filter =
path: _type:
let
base = baseNameOf path;
in
!(
builtins.elem base [
".venv"
"dist"
"build"
"__pycache__"
".pytest_cache"
".ruff_cache"
]
|| nixpkgs.lib.hasSuffix ".pyc" base
);
};
build-system = [ pythonPackages.setuptools ];
doCheck = false;
};
in
{
packages = forAllSystems (
{ pkgs, ... }:
rec {
commy-hermes = commyHermesPlugin pkgs.python3Packages;
default = commy-hermes;
}
);
# Adds `commy-hermes` to every Python package set, so a consumer can build
# it against the same Python as their `hermes-agent` (version-matched) and
# pass it to `services.hermes-agent.extraPythonPackages`.
overlays.default = _final: prev: {
pythonPackagesExtensions = (prev.pythonPackagesExtensions or [ ]) ++ [
(pyfinal: _pyprev: { commy-hermes = commyHermesPlugin pyfinal; })
];
};
devShells = forAllSystems (
{ pkgs, system }:
let
# Tooling the gate needs: bun runs the TS gate, uv drives the
# clients/hermes Python gate (//#test:hermes → scripts/test.sh).
# Shared by both shells so `bun run check`, the pre-commit hook,
# and CI resolve identical tools rather than a global PATH install.
gateTools = [
pkgs.bun
pkgs.uv
];
in
{
default = pkgs.mkShell {
packages = gateTools ++ [ pkgs.typescript-language-server ];
};
# Lean gate shell for CI: exactly gateTools, no interactive extras
# (no language server). CI runs
# `nix develop .#ci --command bun run check`, so it carries only what
# the gate needs.
ci = pkgs.mkShell {
packages = gateTools;
};
# The default shell plus `bd`, the client for the maintainers' issue
# tracker. That tracker is not part of this repository — external
# contributors don't need it and file GitHub issues instead (see
# AGENTS.md) — so `bd` lives here rather than in `default`, and
# entering this shell is opt-in. Select it locally with an untracked
# `.envrc.local` containing `use flake .#maintainer`.
maintainer = pkgs.mkShell {
packages = gateTools ++ [
pkgs.typescript-language-server
beads.packages.${system}.bd
];
};
}
);
};
}