diff --git a/flake.nix b/flake.nix index bc8c0a51..df416758 100644 --- a/flake.nix +++ b/flake.nix @@ -257,6 +257,17 @@ # only want the CLI(s) without the daemon binaries. hivectl = hivectlPkg; hive-forge = hiveForgePkg; + # The daemon/harness/MCP bins alone, no `hivectl` and no second + # `hive-forge` copy. Agent containers use this (via the + # `hyperhive-daemon` overlay output below) instead of `default` — + # they need `hive-agent{,-mcp,-wake}` / + # `hive-bash-{daemon,mcp}` / `hive-matrix-{daemon,mcp}`, never + # the operator-only `hivectl` (dials the *host* admin socket, + # unreachable from inside a container, and drags in + # `wireguard-tools` as a wrapper dep) or a redundant `hive-forge` + # (already on agent PATH via `hive-forge-tools.nix`) — this is + # the fix for the agent-derivation-bloat report. + daemonBins = daemonBins; # Bundled browser assets — see ./nix/frontend.nix. Output is # $out/{dashboard,agent}/ which the Rust binaries serve via # tower_http::ServeDir. @@ -316,6 +327,10 @@ overlays = { default = final: prev: { hyperhive = self.packages.${prev.stdenv.hostPlatform.system}.default; + # Agent-scoped subset of `hyperhive` — daemon/harness/MCP bins + # only, no `hivectl` / no redundant `hive-forge` copy. See + # `packages..daemonBins` above. + hyperhive-daemon = self.packages.${prev.stdenv.hostPlatform.system}.daemonBins; # Bundled frontend dist (see ./nix/frontend.nix). Output is # $out/{dashboard,agent}/; consumers pick the surface they # need. Exposed via the overlay so containers' nix evaluations diff --git a/nix/templates/harness-base.nix b/nix/templates/harness-base.nix index 10d4d242..c03311b4 100644 --- a/nix/templates/harness-base.nix +++ b/nix/templates/harness-base.nix @@ -1276,7 +1276,7 @@ in hyperhive.extraMcpServers = lib.mkMerge [ { bash = lib.mkDefault { - command = "${pkgs.hyperhive}/bin/hive-bash-mcp"; + command = "${pkgs.hyperhive-daemon}/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}/bin/hive-matrix-mcp"; + command = "${pkgs.hyperhive-daemon}/bin/hive-matrix-mcp"; args = [ ]; # Same socket path the hive-matrix-daemon service binds # via its `RuntimeDirectory = "hive-matrix"`. Keeps the @@ -1636,7 +1636,17 @@ in environment.systemPackages = with pkgs; [ - hyperhive + # 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 + # `hive-forge-tools.nix`) — closure bloat + dead surface with no + # functional upside inside a container. + hyperhive-daemon claude-code bashInteractive coreutils-full @@ -1946,7 +1956,7 @@ in HIVE_ICON_PNG = "${iconPng}"; }; serviceConfig = { - ExecStart = "${pkgs.hyperhive}/bin/hive-matrix-daemon"; + ExecStart = "${pkgs.hyperhive-daemon}/bin/hive-matrix-daemon"; SyslogIdentifier = "hive-matrix-daemon"; Restart = "on-failure"; RestartSec = 5; @@ -2002,7 +2012,7 @@ in # less robust if the two vars ever diverge. }; serviceConfig = { - ExecStart = "${pkgs.hyperhive}/bin/hive-bash-daemon"; + ExecStart = "${pkgs.hyperhive-daemon}/bin/hive-bash-daemon"; SyslogIdentifier = "hive-bash-daemon"; Restart = "on-failure"; RestartSec = 3; @@ -2036,7 +2046,7 @@ in before = [ "hive-ag3nt.service" ]; environment.RUST_LOG = "info"; serviceConfig = { - ExecStart = "${pkgs.hyperhive}/bin/hive-agent-mcp --http 127.0.0.1:${toString config.hyperhive.mcp.httpPort}"; + ExecStart = "${pkgs.hyperhive-daemon}/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 @@ -2167,7 +2177,7 @@ in HIVE_EXTRA_WEB_PROXIES = builtins.toJSON config.hyperhive.extraWebProxies; }; serviceConfig = { - ExecStart = "${pkgs.hyperhive}/bin/${binary}"; + ExecStart = "${pkgs.hyperhive-daemon}/bin/${binary}"; # Pin the journal identity to the binary name (otherwise systemd # derives SyslogIdentifier from the ExecStart basename). SyslogIdentifier = binary;