fix(#2399): split daemon/harness/MCP bins into per-binary packages

mara: "no, do split packages for the separate daemons" — instead of
grouping all daemon/harness/MCP bins into one hyperhive-daemon
derivation, each bin (hive-c0re, hive-priv, hive-agent,
hive-agent-mcp, hive-agent-wake, hive-bash-daemon, hive-bash-mcp,
hive-matrix-daemon, hive-matrix-mcp, hive-metric) is now its own
named package + overlay output, matching the existing hivectl /
hive-forge split. harness-base.nix's ExecStart/command lines now
point at the specific pkgs.hive-* each ExecStart needs, and
environment.systemPackages only carries the two bins actually
PATH-looked-up in-container (hive-agent-wake, hive-metric) instead
of the whole bundle.
This commit is contained in:
atlas 2026-07-13 17:42:37 +02:00 committed by mara
commit 650224c9c6
2 changed files with 94 additions and 48 deletions

View file

@ -1276,7 +1276,7 @@ in
hyperhive.extraMcpServers = lib.mkMerge [
{
bash = lib.mkDefault {
command = "${pkgs.hyperhive-daemon}/bin/hive-bash-mcp";
command = "${pkgs.hive-bash-mcp}/bin/hive-bash-mcp";
args = [ ];
env.HIVE_BASH_SOCKET = "/run/hive-bash/socket";
allowedTools = [ "*" ];
@ -1284,7 +1284,7 @@ in
}
(lib.mkIf config.hyperhive.matrix.enable {
matrix = lib.mkDefault {
command = "${pkgs.hyperhive-daemon}/bin/hive-matrix-mcp";
command = "${pkgs.hive-matrix-mcp}/bin/hive-matrix-mcp";
args = [ ];
# Same socket path the hive-matrix-daemon service binds
# via its `RuntimeDirectory = "hive-matrix"`. Keeps the
@ -1636,17 +1636,24 @@ in
environment.systemPackages =
with pkgs;
[
# Agent-scoped subset of `pkgs.hyperhive` — daemon/harness/MCP
# bins the harness itself execs (see the ExecStarts above) plus
# whatever else lands on PATH for claude's Bash tool. Deliberately
# NOT the full `pkgs.hyperhive` bundle: that also carries `hivectl`
# (a host-admin CLI that dials the *host* admin socket — useless
# and unreachable from inside a container — wrapped with
# `wireguard-tools` for `hivectl wg`) and a second, redundant
# `hive-forge` copy (already provided below via
# Per-bin split packages (see flake.nix `packages.<system>.hive-*`)
# rather than the full `pkgs.hyperhive` bundle — that bundle also
# carries `hivectl` (a host-admin CLI that dials the *host* admin
# socket — useless and unreachable from inside a container —
# wrapped with `wireguard-tools` for `hivectl wg`) and a second,
# redundant `hive-forge` copy (already provided below via
# `hive-forge-tools.nix`) — closure bloat + dead surface with no
# functional upside inside a container.
hyperhive-daemon
# functional upside inside a container. The daemon/harness/MCP
# bins the harness execs (hive-agent{,-mcp}, hive-bash-daemon,
# hive-matrix-daemon, hive-bash-mcp, hive-matrix-mcp) are wired
# via their own ExecStart/command lines above with the matching
# `pkgs.hive-*` package — they don't need to be on PATH too.
# Only these two are actually looked up on PATH by claude/shell
# code inside the container: `hive-agent-wake` (external wake CLI,
# docs/turn-loop/mcp.md) and `hive-metric` (agent-emitted custom
# metrics CLI, docs/observability.md).
hive-agent-wake
hive-metric
claude-code
bashInteractive
coreutils-full
@ -1956,7 +1963,7 @@ in
HIVE_ICON_PNG = "${iconPng}";
};
serviceConfig = {
ExecStart = "${pkgs.hyperhive-daemon}/bin/hive-matrix-daemon";
ExecStart = "${pkgs.hive-matrix-daemon}/bin/hive-matrix-daemon";
SyslogIdentifier = "hive-matrix-daemon";
Restart = "on-failure";
RestartSec = 5;
@ -2012,7 +2019,7 @@ in
# less robust if the two vars ever diverge.
};
serviceConfig = {
ExecStart = "${pkgs.hyperhive-daemon}/bin/hive-bash-daemon";
ExecStart = "${pkgs.hive-bash-daemon}/bin/hive-bash-daemon";
SyslogIdentifier = "hive-bash-daemon";
Restart = "on-failure";
RestartSec = 3;
@ -2046,7 +2053,7 @@ in
before = [ "hive-ag3nt.service" ];
environment.RUST_LOG = "info";
serviceConfig = {
ExecStart = "${pkgs.hyperhive-daemon}/bin/hive-agent-mcp --http 127.0.0.1:${toString config.hyperhive.mcp.httpPort}";
ExecStart = "${pkgs.hive-agent-mcp}/bin/hive-agent-mcp --http 127.0.0.1:${toString config.hyperhive.mcp.httpPort}";
SyslogIdentifier = "hive-mcp-http";
# `always` (not `on-failure`): this endpoint is load-bearing — the
# sole hyperhive-MCP transport, so a down window is total
@ -2177,7 +2184,7 @@ in
HIVE_EXTRA_WEB_PROXIES = builtins.toJSON config.hyperhive.extraWebProxies;
};
serviceConfig = {
ExecStart = "${pkgs.hyperhive-daemon}/bin/${binary}";
ExecStart = "${pkgs.hive-agent}/bin/${binary}";
# Pin the journal identity to the binary name (otherwise systemd
# derives SyslogIdentifier from the ExecStart basename).
SyslogIdentifier = binary;