From 06e8a9a09eca0b32d3b60f078d808dda008f02ab Mon Sep 17 00:00:00 2001 From: atlas Date: Sun, 30 Aug 2026 14:17:06 +0200 Subject: [PATCH] Fix nix references in prose that no longer resolve Nine of the 38 .nix tokens mentioned anywhere in *.rs did not name anything that exists. Twelve mentions, five distinct targets: hive-c0re.nix, hive-gateway.nix and hive-forge.nix are all directories now; nix/modules/ is not a directory we have; hive-forge-tools.nix was a bash script the binary replaced and is gone. Where the reference is load-bearing it is corrected rather than deleted, because the reference is the point: a comment saying a constant must match a nix literal is only useful if you can open the file it names. Where the module member was unambiguous the path now names it exactly. paths.rs's STATE_ROOT marker was the worst of them: it claimed the value came from services.hyperhive.c0re.statePath, in hive-c0re.nix. Neither exists. The option is not declared anywhere and the file is a directory, so a "must match" contract pointed at two things that cannot be opened. /var/lib/hyperhive is hardcoded on both sides, which is what the comment now says. hive-forge-tools.nix keeps no replacement: naming a file that was deliberately deleted helps nobody, and "replaces a prior bash script" is complete without it. Measured before and after with the same command: 9 unresolved of 38 before, 4 of 35 after. The remaining four are an example path in a doc comment, an upstream nixpkgs path, and two from one synthetic test fixture. --- hive-c0re/src/container_view.rs | 2 +- hive-c0re/src/dashboard/mod.rs | 3 ++- hive-c0re/src/dashboard/state_snapshot.rs | 2 +- hive-c0re/src/gateway_nginx.rs | 2 +- hive-c0re/src/matrix.rs | 2 +- hive-c0re/src/paths.rs | 9 ++++++--- hive-c0re/src/server.rs | 4 ++-- hive-c0re/src/stats/hive_stats.rs | 2 +- hive-forge/src/main.rs | 4 ++-- 9 files changed, 17 insertions(+), 13 deletions(-) diff --git a/hive-c0re/src/container_view.rs b/hive-c0re/src/container_view.rs index ef7d5459..4c4e7a08 100644 --- a/hive-c0re/src/container_view.rs +++ b/hive-c0re/src/container_view.rs @@ -300,7 +300,7 @@ fn read_active_model(name: &hive_types::Ident) -> Option { } /// Host-side hive + swarm display names, read from the c0re service's -/// own process env. The `hive-c0re.nix` module sets these from +/// own process env. The hyperhive NixOS module sets these from /// `services.hyperhive.hiveName` + `services.hyperhive.swarm.name` /// (the hive names itself; the swarm it joins is named one level out). /// The agent-side diff --git a/hive-c0re/src/dashboard/mod.rs b/hive-c0re/src/dashboard/mod.rs index c95b36fd..c0a62716 100644 --- a/hive-c0re/src/dashboard/mod.rs +++ b/hive-c0re/src/dashboard/mod.rs @@ -115,7 +115,8 @@ pub async fn serve( webhook_secret: Option, ) -> Result<()> { // API-only: the gateway static-serves the dashboard dist and proxies - // non-static requests here (see hive-gateway.nix). Unmatched paths 404. + // non-static requests here (see `nix/host-modules/hive-gateway/vhosts.nix`). + // Unmatched paths 404. // No static fallback needed here either. Every route (SSE streams // included — `utoipa::path` can document an SSE body as an opaque // `text/event-stream` string, it just can't model individual frame diff --git a/hive-c0re/src/dashboard/state_snapshot.rs b/hive-c0re/src/dashboard/state_snapshot.rs index 6e75ce50..4b806fbb 100644 --- a/hive-c0re/src/dashboard/state_snapshot.rs +++ b/hive-c0re/src/dashboard/state_snapshot.rs @@ -76,7 +76,7 @@ pub(super) struct StateSnapshot { /// Whether the matrix GUI is reachable at `/matrix/`. Sourced from /// `HIVE_MATRIX_GUI_ENABLED` env var (set by the c0re NixOS module /// when `services.hyperhive.swarm.matrix.gui.enable` is on). The gateway - /// (hive-gateway.nix) does the actual `/matrix/` static serving; + /// (`nix/host-modules/hive-gateway/vhosts.nix`) does the actual `/matrix/` static serving; /// this flag is just an availability signal for iris's dashboard /// chrome so the `M4TR1X →` tab doesn't flash when the GUI is off. matrix_gui_enabled: bool, diff --git a/hive-c0re/src/gateway_nginx.rs b/hive-c0re/src/gateway_nginx.rs index 7f94e802..dd75a6a4 100644 --- a/hive-c0re/src/gateway_nginx.rs +++ b/hive-c0re/src/gateway_nginx.rs @@ -97,7 +97,7 @@ fn render(names: &[String], frontend_dir: Option<&str>) -> String { // Split mode: try to serve files from the nix-store dist first; // fall through to the agent daemon for anything not found there. // - // `frontend` is a nix store path injected at build time by hive-c0re.nix + // `frontend` is a nix store path injected at build time by the hyperhive module // (`HIVE_AGENT_FRONTEND_DIR = "${cfg.frontend}/agent"`). Nix store paths // are of the form `/nix/store/-` — only [a-z0-9/._-], never // shell metacharacters — so interpolating directly into the nginx config diff --git a/hive-c0re/src/matrix.rs b/hive-c0re/src/matrix.rs index 7054cf7a..d524e0ce 100644 --- a/hive-c0re/src/matrix.rs +++ b/hive-c0re/src/matrix.rs @@ -16,7 +16,7 @@ use reqwest::StatusCode; use crate::coordinator::Coordinator; /// Client-server API base this daemon provisions against, from -/// `HIVE_MATRIX_API_URL` (set by `hive-c0re.nix` from +/// `HIVE_MATRIX_API_URL` (set by the hyperhive NixOS module from /// `services.hyperhive.swarm.matrix.apiUrl`). /// /// `None` means **this hive has no homeserver to provision against** and diff --git a/hive-c0re/src/paths.rs b/hive-c0re/src/paths.rs index c45d761b..88eb2366 100644 --- a/hive-c0re/src/paths.rs +++ b/hive-c0re/src/paths.rs @@ -31,12 +31,14 @@ use std::path::{Path, PathBuf}; pub use hive_host_sock::{AGENTS_ROOT, GATEWAY_HTPASSWD, HOST_SOCKET, agent_state_dir}; /// Root of all hive-c0re persistent state. -// nix: bind-mount source `services.hyperhive.c0re.statePath` (hive-c0re.nix) — must match. +// nix: the same literal is written in `nix/host-modules/hive-c0re/default.nix` — must match. +// Not option-driven: there is no `statePath` option, the path is hardcoded both sides. pub const STATE_ROOT: &str = "/var/lib/hyperhive"; /// `/run/hyperhive` — hive-c0re's runtime root (host admin socket, the /// per-agent runtime dirs). Regenerated each boot; not persistent state. -// nix: `RuntimeDirectory=hyperhive` on the hive-c0re service (hive-c0re.nix) — must match. +// nix: `RuntimeDirectory=hyperhive` on the hive-c0re service +// (`nix/host-modules/hive-c0re/default.nix`) — must match. // priv-sock: `hive_priv_sock::AGENT_RUNTIME_ROOT` is `RUNTIME_ROOT + "/agents"` and must // stay in sync; the privsep boundary prevents importing across the crate. pub const RUNTIME_ROOT: &str = "/run/hyperhive"; @@ -247,7 +249,8 @@ pub fn gateway_agents_conf() -> PathBuf { /// `forge-core-token` — the hive-c0re forge account API token. A `&str` /// (used in `Path::new` + user-facing `format!` messages), so it stays a /// const rather than a `PathBuf` fn. -// nix: bind-mounted into the forge container / read at provisioning (hive-forge.nix) — must match. +// nix: read at provisioning; the same literal is in +// `nix/host-modules/hive-c0re/default.nix` and `nix/host-modules/hive-ci.nix` — must match. pub const FORGE_CORE_TOKEN: &str = "/var/lib/hyperhive/forge-core-token"; /// `matrix-register-token` — shared matrix registration token. diff --git a/hive-c0re/src/server.rs b/hive-c0re/src/server.rs index 36049d75..2a469429 100644 --- a/hive-c0re/src/server.rs +++ b/hive-c0re/src/server.rs @@ -160,7 +160,7 @@ async fn dispatch(req: &HostRequest, coord: Arc) -> HostResponse { HostRequest::AgentExists { name } => HostResponse::agent_exists(agent_exists(name)?), HostRequest::AgentStatus => handle_agent_status(&coord).await, // The hive domain + per-surface public URLs are injected into - // c0re's service env by hive-c0re.nix; surface them so the + // c0re's service env by the hyperhive module; surface them so the // operator CLI can fill in this hive's own identity (the // federation peer-config block) and open the web surfaces // (`hivectl open`). @@ -1038,7 +1038,7 @@ fn is_broad_scope(scope: &LifecycleScope) -> bool { } /// Assemble this hive's domain + browser-facing web URLs from c0re's -/// service env (injected by hive-c0re.nix). Each field is `None` when its +/// service env (injected by the hyperhive NixOS module). Each field is `None` when its /// surface isn't browser-reachable (domain unset, forge not behind the /// gateway, matrix GUI off), so the CLI can hint precisely instead of /// opening a dead link. Scheme matches the existing `HIVE_FORGE_PUBLIC_URL` diff --git a/hive-c0re/src/stats/hive_stats.rs b/hive-c0re/src/stats/hive_stats.rs index 93bf6615..5cdce915 100644 --- a/hive-c0re/src/stats/hive_stats.rs +++ b/hive-c0re/src/stats/hive_stats.rs @@ -115,7 +115,7 @@ pub type PriceTable = HashMap; /// Sonnet 4.x, Haiku 4.5); `cache_write` uses the 1-hour cache-TTL price, /// which is the default through the Claude subscription the agents run /// on. Keep in sync with the `services.hyperhive.modelPrices` nix default -/// (`nix/modules/hive-c0re.nix`). +/// (`nix/host-modules/hive-c0re/options.nix`). fn builtin_prices(model: &str) -> Prices { let m = model.to_ascii_lowercase(); if m.contains("opus") { diff --git a/hive-forge/src/main.rs b/hive-forge/src/main.rs index 830dad12..24d7aba0 100644 --- a/hive-forge/src/main.rs +++ b/hive-forge/src/main.rs @@ -13,8 +13,8 @@ //! `forge-