diff --git a/nix/modules/hive-c0re.nix b/nix/modules/hive-c0re.nix index 49d0036a..7a1fc782 100644 --- a/nix/modules/hive-c0re.nix +++ b/nix/modules/hive-c0re.nix @@ -86,20 +86,26 @@ let --base0F: ${c.base0F}; } ''; - # Overlay the generated colors.css onto the dashboard dist subtree. - # Dashboard-first: only the dashboard surface is wired to this - # (HIVE_STATIC_DIR below), so we swap only the dashboard's colors.css. - # Agent theming is a separate follow-up — the per-agent harness builds - # its frontend in its own nixosSystem, so it needs the base16 palette - # forwarded host→agent rather than this host-side overlay. + # Overlay the generated colors.css onto both dist subtrees. Both the + # dashboard (served by hive-c0re via HIVE_STATIC_DIR) and the agent UIs + # (served by the gateway from HIVE_AGENT_FRONTEND_DIR — static files + # straight from the store) read their colors.css from this host-side + # tree, so swapping both re-themes both surfaces. + # + # Not covered here: an agent reached directly on its own harness web + # server (no gateway) serves from its per-agent `mergedDist`, built in + # the agent's own nixosSystem with no access to the host's stylix + # colours — theming that path needs the base16 palette forwarded + # host→agent, tracked separately. themedFrontend = c: pkgs.runCommand "hyperhive-frontend-themed" { } '' cp -r ${cfg.frontend} $out chmod -R u+w $out install -m644 ${themedColorsCss c} $out/dashboard/static/colors.css + install -m644 ${themedColorsCss c} $out/agent/static/colors.css ''; - servedDashboardFrontend = + servedFrontend = if stylixThemeColors != null then themedFrontend stylixThemeColors else cfg.frontend; in { @@ -723,7 +729,7 @@ in # Path to the dashboard static dist. The hive-c0re axum router # serves this via `tower_http::ServeDir` for any path it doesn't # match against an API/action route. - HIVE_STATIC_DIR = "${servedDashboardFrontend}/dashboard"; + HIVE_STATIC_DIR = "${servedFrontend}/dashboard"; # Path to the base agent frontend dist. hive-c0re's # gateway_nginx.rs uses this to generate split location # blocks in agents.conf — static HTML/CSS/JS served from the @@ -731,7 +737,7 @@ in # agent daemon. The nix store is shared across nspawn # containers, so this path is reachable from inside the # gateway container's nginx. - HIVE_AGENT_FRONTEND_DIR = "${cfg.frontend}/agent"; + HIVE_AGENT_FRONTEND_DIR = "${servedFrontend}/agent"; # Path to the static runtime asset tree (branding + claude # prompts). `hive_sh4re::assets::*` reads paths underneath. # `forge.rs` reads the avatar PNGs from here on startup.