From 453ee9c44cc8530f7f474763ad32b69f9016c8ef Mon Sep 17 00:00:00 2001 From: atlas Date: Wed, 3 Jun 2026 19:00:12 +0200 Subject: [PATCH] fix(nix): merge duplicate hyperhive.extraMcpServers assignments in harness-base bash and matrix MCP entries were both assigned to the same attribute in the same attrset literal, causing nix evaluation to fail with "attribute already defined". Merged both into a single lib.mkMerge list under one assignment. --- nix/templates/harness-base.nix | 52 ++++++++++++++++------------------ 1 file changed, 25 insertions(+), 27 deletions(-) diff --git a/nix/templates/harness-base.nix b/nix/templates/harness-base.nix index 7315e5cc..48349627 100644 --- a/nix/templates/harness-base.nix +++ b/nix/templates/harness-base.nix @@ -752,22 +752,31 @@ in fi ''; - # Auto-inject the matrix MCP entry when matrix is enabled. - # Operator can override or disable by setting their own - # `extraMcpServers.matrix` (nix submodule merge takes the operator's - # value) or by flipping `hyperhive.matrix.enable = false`. - hyperhive.extraMcpServers = lib.mkIf config.hyperhive.matrix.enable { - matrix = lib.mkDefault { - command = "${pkgs.hyperhive}/bin/hive-matrix-mcp"; - args = [ ]; - # Same socket path the hive-matrix-daemon service binds - # via its `RuntimeDirectory = "hive-matrix"`. Keeps the - # bridge + daemon in sync without baking the path into - # the Rust default — the env override wins for both. - env.HIVE_MATRIX_SOCKET = "/run/hive-matrix/socket"; - allowedTools = [ "*" ]; - }; - }; + # Auto-inject built-in MCP servers. bash is always present; matrix is + # conditional on hyperhive.matrix.enable. Both use lib.mkDefault so + # the operator's own agent.nix can override individual entries. + hyperhive.extraMcpServers = lib.mkMerge [ + { + bash = lib.mkDefault { + command = "${pkgs.hyperhive}/bin/hive-bash-mcp"; + args = [ ]; + env.HIVE_BASH_SOCKET = "/run/hive-bash/socket"; + allowedTools = [ "*" ]; + }; + } + (lib.mkIf config.hyperhive.matrix.enable { + matrix = lib.mkDefault { + command = "${pkgs.hyperhive}/bin/hive-matrix-mcp"; + args = [ ]; + # Same socket path the hive-matrix-daemon service binds + # via its `RuntimeDirectory = "hive-matrix"`. Keeps the + # bridge + daemon in sync without baking the path into + # the Rust default — the env override wins for both. + env.HIVE_MATRIX_SOCKET = "/run/hive-matrix/socket"; + allowedTools = [ "*" ]; + }; + }) + ]; environment.etc."hyperhive/extra-mcp.json".text = builtins.toJSON config.hyperhive.extraMcpServers; @@ -1149,17 +1158,6 @@ in }; }; - # Inject the bash MCP bridge into every agent's extraMcpServers. - # The bridge connects to hive-bash-daemon on the same socket. - hyperhive.extraMcpServers = { - bash = lib.mkDefault { - command = "${pkgs.hyperhive}/bin/hive-bash-mcp"; - args = [ ]; - env.HIVE_BASH_SOCKET = "/run/hive-bash/socket"; - allowedTools = [ "*" ]; - }; - }; - # Re-fire the daemon when the matrix token appears (hive-c0re # provisions it after agent containers come up). Without this # the daemon would exit 0 silently on first boot and the MCP