Deploy Hermes agent on Vega with Matrix gateway and Nova model provider #309

Closed
opened 2026-10-11 08:37:49 +01:00 by nimmo · 3 comments
Owner

Context

Deploy Hermes Agent as a background daemon on Vega.

Scope & Objectives

  • Add upstream hermes-agent flake input (github:NousResearch/hermes-agent).
  • Restore and adapt modules/services/hermes.nix for Matrix gateway with E2EE disabled (matrixE2eeMode = "off").
  • Configure primary model to qwen3.6:35b-a3b-q8_0 via custom OpenAI provider https://ollama-nova.nimmog.uk/v1 using dedicated Pangolin virtual API key.
  • Configure fallback provider to OpenCode Go (opencode-go) using opencode-go-api-key.
  • Enable nixosConfig.hermes in hosts/vega/default.nix.
  • Add auto-update classification in lib/auto-update-policy.nix.

Verification

  • nix flake check evaluates cleanly.
  • Test deployment or activation on Vega.
## Context Deploy Hermes Agent as a background daemon on Vega. ## Scope & Objectives - Add upstream hermes-agent flake input (github:NousResearch/hermes-agent). - Restore and adapt modules/services/hermes.nix for Matrix gateway with E2EE disabled (matrixE2eeMode = "off"). - Configure primary model to qwen3.6:35b-a3b-q8_0 via custom OpenAI provider https://ollama-nova.nimmog.uk/v1 using dedicated Pangolin virtual API key. - Configure fallback provider to OpenCode Go (opencode-go) using opencode-go-api-key. - Enable nixosConfig.hermes in hosts/vega/default.nix. - Add auto-update classification in lib/auto-update-policy.nix. ## Verification - nix flake check evaluates cleanly. - Test deployment or activation on Vega.
Author
Owner

Update

  1. Authentication Fix (key_env):

    • Identified root cause of HTTP 401: Invalid API key provided: Hermes treats provider: "custom" endpoints without explicit key_env as keyless local endpoints and substitutes Bearer no-key-required.
    • Added defaultKeyEnv = "CUSTOM_API_KEY" option in modules/services/hermes.nix and set key_env on model, providers, and default model aliases.
    • Tested direct completion and runtime provider resolution on Vega; inference to Nova Ollama via Pangolin virtual key is authenticated and working.
  2. Fleet MCP Servers Registration:

    • Extended modules/mcp/default.nix with hermesMcpServers and hermesEnv.
    • Added hermes block to modules/mcp/redview.nix.
    • Wired services.hermes-agent.mcpServers = mcp.hermesMcpServers in modules/services/hermes.nix under enableMcp (defaulting to true).
    • Populated MCP auth tokens (KIWIFS_MCP_TOKEN, NAVIDROME_MCP_TOKEN, TRILIUM_ETAPI_TOKEN, SYNTHSEEK_MCP_API_KEY, REDVIEW_MCP_API_KEY) into sops.templates."hermes-env".
    • Granted group = "hermes"; mode = "0440" access to MCP secrets for stdio launchers (beszel, karakeep, pangolin).
    • All 11 fleet MCP servers (beszel, bookstack, forgejo, karakeep, kiwifs, navidrome, nixos, pangolin, redview, synthseek, trilium) evaluate cleanly into Hermes's settings.mcp_servers.
    • Flake validation (nix flake check) passed cleanly.
### Update 1. **Authentication Fix (`key_env`)**: - Identified root cause of `HTTP 401: Invalid API key provided`: Hermes treats `provider: "custom"` endpoints without explicit `key_env` as keyless local endpoints and substitutes `Bearer no-key-required`. - Added `defaultKeyEnv = "CUSTOM_API_KEY"` option in `modules/services/hermes.nix` and set `key_env` on `model`, `providers`, and default model aliases. - Tested direct completion and runtime provider resolution on Vega; inference to Nova Ollama via Pangolin virtual key is authenticated and working. 2. **Fleet MCP Servers Registration**: - Extended `modules/mcp/default.nix` with `hermesMcpServers` and `hermesEnv`. - Added `hermes` block to `modules/mcp/redview.nix`. - Wired `services.hermes-agent.mcpServers = mcp.hermesMcpServers` in `modules/services/hermes.nix` under `enableMcp` (defaulting to `true`). - Populated MCP auth tokens (`KIWIFS_MCP_TOKEN`, `NAVIDROME_MCP_TOKEN`, `TRILIUM_ETAPI_TOKEN`, `SYNTHSEEK_MCP_API_KEY`, `REDVIEW_MCP_API_KEY`) into `sops.templates."hermes-env"`. - Granted `group = "hermes"; mode = "0440"` access to MCP secrets for stdio launchers (`beszel`, `karakeep`, `pangolin`). - All 11 fleet MCP servers (`beszel`, `bookstack`, `forgejo`, `karakeep`, `kiwifs`, `navidrome`, `nixos`, `pangolin`, `redview`, `synthseek`, `trilium`) evaluate cleanly into Hermes's `settings.mcp_servers`. - Flake validation (`nix flake check`) passed cleanly.
Author
Owner

Web search support via native SearXNG has been implemented and validated:

  1. SearXNG Service Module (modules/services/searxng.nix):

    • Uses native services.searx on port 8888, bound to 0.0.0.0.
    • Opens port 8888 on nebula.mesh interface (and accessible on loopback), blocked on WAN interfaces.
    • Enables JSON and HTML search formats (settings.search.formats = [ "html" "json" ]).
    • Generates a local random secret key automatically into /var/lib/searx/searx-env via searx-secret-key.service if not provided via SOPS/environment file, keeping secrets out of the world-readable /nix/store.
    • Registers with services.serviceFailureMonitor.services.
  2. Hermes Configuration (modules/services/hermes.nix):

    • Added enableWebSearch (default true) and searxngUrl (default http://127.0.0.1:8888).
    • Injected SEARXNG_URL into hermes-env SOPS template.
    • Configured settings.web.search_backend = "searxng" for Hermes agent.
  3. Vega Deployment (hosts/vega/default.nix):

    • Imported ../../modules/services/searxng.nix and set nixosConfig.searxng.enable = true;.
  4. Validation:

    • nix flake check passed cleanly across all host configurations.
    • Ready for test deployment on Vega (just test-remote vega or remote switch).
Web search support via native SearXNG has been implemented and validated: 1. **SearXNG Service Module (`modules/services/searxng.nix`)**: - Uses native `services.searx` on port 8888, bound to `0.0.0.0`. - Opens port 8888 on `nebula.mesh` interface (and accessible on loopback), blocked on WAN interfaces. - Enables JSON and HTML search formats (`settings.search.formats = [ "html" "json" ]`). - Generates a local random secret key automatically into `/var/lib/searx/searx-env` via `searx-secret-key.service` if not provided via SOPS/environment file, keeping secrets out of the world-readable `/nix/store`. - Registers with `services.serviceFailureMonitor.services`. 2. **Hermes Configuration (`modules/services/hermes.nix`)**: - Added `enableWebSearch` (default true) and `searxngUrl` (default `http://127.0.0.1:8888`). - Injected `SEARXNG_URL` into `hermes-env` SOPS template. - Configured `settings.web.search_backend = "searxng"` for Hermes agent. 3. **Vega Deployment (`hosts/vega/default.nix`)**: - Imported `../../modules/services/searxng.nix` and set `nixosConfig.searxng.enable = true;`. 4. **Validation**: - `nix flake check` passed cleanly across all host configurations. - Ready for test deployment on Vega (`just test-remote vega` or remote switch).
Author
Owner

Deployment & Verification Summary

  1. Auto-Update & Activation on Vega:

    • Following PR #311 merge and fix commit e2b4b966aa20a72cbccfd917eb83e6ceb7097751, Vega's scheduled nixos-auto-update.service cycle triggered at 20:07:44 BST.
    • Built system closure on Nova and activated generation /nix/store/1ivhphcf7ypxi7qymg2b0rccah2wcs2p-nixos-system-vega-26.11.20261008.8edc0c7 via detached switch helper nixos-auto-update-switch-vega.
    • Verified deployed revision: e2b4b966aa20a72cbccfd917eb83e6ceb7097751.
  2. Hermes Agent Gateway (hermes-agent.service):

    • ExecStartPre completed cleanly with exit code 0/SUCCESS (directory permissions handled via chmod -R u+w before cleanup).
    • Gateway daemon is active and running (PID 2096070).
    • Profile repository synchronized from Forgejo to /srv/services/hermes/profile.
    • Symlinks verified:
      • /srv/services/hermes/.hermes/skills -> /srv/services/hermes/profile/skills
      • /srv/services/hermes/.hermes/SOUL.md -> /srv/services/hermes/profile/SOUL.md
      • /srv/services/hermes/.hermes/distribution.yaml -> /srv/services/hermes/profile/distribution.yaml
    • Child MCP supervisor and registered MCP servers running (beszel-mcp, karakeep-mcp, mcp-nixos, mcp-pangolin).
    • Matrix gateway connected to homeserver.
  3. SearXNG Service (searx.service):

    • Active on 127.0.0.1:8888 and successfully serving search queries.
  4. Host Health:

    • Beszel reports Vega healthy (CPU 16%, RAM 34%, 0 failed services across 96 total systemd units).
### Deployment & Verification Summary 1. **Auto-Update & Activation on Vega**: - Following PR #311 merge and fix commit `e2b4b966aa20a72cbccfd917eb83e6ceb7097751`, Vega's scheduled `nixos-auto-update.service` cycle triggered at 20:07:44 BST. - Built system closure on Nova and activated generation `/nix/store/1ivhphcf7ypxi7qymg2b0rccah2wcs2p-nixos-system-vega-26.11.20261008.8edc0c7` via detached switch helper `nixos-auto-update-switch-vega`. - Verified deployed revision: `e2b4b966aa20a72cbccfd917eb83e6ceb7097751`. 2. **Hermes Agent Gateway (`hermes-agent.service`)**: - `ExecStartPre` completed cleanly with exit code 0/SUCCESS (directory permissions handled via `chmod -R u+w` before cleanup). - Gateway daemon is active and running (`PID 2096070`). - Profile repository synchronized from Forgejo to `/srv/services/hermes/profile`. - Symlinks verified: - `/srv/services/hermes/.hermes/skills` -> `/srv/services/hermes/profile/skills` - `/srv/services/hermes/.hermes/SOUL.md` -> `/srv/services/hermes/profile/SOUL.md` - `/srv/services/hermes/.hermes/distribution.yaml` -> `/srv/services/hermes/profile/distribution.yaml` - Child MCP supervisor and registered MCP servers running (`beszel-mcp`, `karakeep-mcp`, `mcp-nixos`, `mcp-pangolin`). - Matrix gateway connected to homeserver. 3. **SearXNG Service (`searx.service`)**: - Active on `127.0.0.1:8888` and successfully serving search queries. 4. **Host Health**: - Beszel reports Vega healthy (CPU 16%, RAM 34%, 0 failed services across 96 total systemd units).
nimmo closed this issue 2026-10-11 20:12:11 +01:00
Sign in to join this conversation.
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
nimmo/nixos-config#309
No description provided.