Watch
0
0
Fork
You've already forked hyperhive
0

Compare commits

...
Author SHA1 Message Date
atlas
9a01906275 hive-sh4re: drop the nix explanation from the panic message too
Same layering rule as the previous commit, one construct over. The
remediation text explained how nix wires the var and pointed at
`nix/assets.nix` -- a path that does not exist either, so it carried
both defects this branch is about.

What a developer hitting this panic needs is the layout to point at,
which is a fact about this crate.
2026-08-30 04:19:11 +02:00
atlas
1e011bcd93 hive-sh4re: state the env-var contract, not who sets it
Per review: the rust code should not explain nix stuff.

The original doc comment named nix modules as the setters of
HIVE_ASSETS_DIR, and the previous commit here made that worse -- it
replaced two stale nix paths with four accurate ones, entrenching a
cross-layer explanation instead of removing it.

What this crate actually depends on is the env var and the layout it
points at. Who sets it belongs to the layer that sets it.
2026-08-30 04:19:11 +02:00
atlas
d17aa254dd nix, hive-sh4re: name modules that exist in the stale harness-base refs
harness-base.nix has never existed in this tree. Four comments named it,
or a `harness-base` module, as the place to look:

- weston-vnc.nix: the agent user is declared and home-chowned by
  nix/agent-modules/user.nix
- hive-ci.nix: the sandbox-fallback reasoning lives in
  nix/agent-modules/default.nix -- which the very next comment block in
  the same file already cites correctly
- packages/default.nix: the per-bin consumer is
  nix/agent-modules/packages.nix
- hive-sh4re/src/assets.rs: HIVE_ASSETS_DIR is set by
  hive-c0re/environment.nix and agent-modules/default.nix +
  agent-service.nix, and the package is built by nix/packages/assets.nix
  -- not the equally nonexistent nix/assets.nix

assets.rs was twice declared out of scope on the sibling PR because it
names a module rather than a file. That distinction was real and
irrelevant: neither the module nor the nix/assets.nix path it points at
exists. Reading the wording is not checking the reference.

Every replacement path was verified to exist, with a deliberately bogus
path as a control.
2026-08-30 04:19:11 +02:00
4 changed files with 11 additions and 13 deletions

View file

@ -3,9 +3,9 @@
//! (`hive-c0re`) and the in-container harness binaries so they agree //! (`hive-c0re`) and the in-container harness binaries so they agree
//! on the lookup contract. //! on the lookup contract.
//! //!
//! At runtime, the path is read from `$HIVE_ASSETS_DIR`. In nix //! At runtime, the path is read from `$HIVE_ASSETS_DIR`. Setting it is
//! builds that env var is set by the `hive-c0re` / `harness-base` modules //! the deployment's job; this crate's contract is only that it names a
//! to `${pkgs.hyperhive-assets}/share/hyperhive` (see `nix/assets.nix`). //! directory laid out like the packaged assets.
//! For `cargo run` outside nix, set it yourself: //! For `cargo run` outside nix, set it yourself:
//! //!
//! ```sh //! ```sh
@ -34,12 +34,10 @@ fn dir() -> PathBuf {
match std::env::var("HIVE_ASSETS_DIR") { match std::env::var("HIVE_ASSETS_DIR") {
Ok(v) if !v.is_empty() => PathBuf::from(v), Ok(v) if !v.is_empty() => PathBuf::from(v),
_ => panic!( _ => panic!(
"HIVE_ASSETS_DIR is not set. Inside the nix-built systemd \ "HIVE_ASSETS_DIR is not set. A deployment sets it; when \
units this is wired automatically from \ running a binary outside one, point it at a directory \
`pkgs.hyperhive-assets`; for `cargo run` outside nix, \ with `branding/` and `prompts/` subdirs. See \
set it to a directory laid out like \ hive-sh4re/src/assets.rs for the contract.",
`nix/assets.nix`'s output (branding/ + prompts/ \
subdirs). See hive-sh4re/src/assets.rs for the contract.",
), ),
} }
} }

View file

@ -6,7 +6,7 @@
}: }:
let let
# GUI processes run as the agent's own non-root user — the same user # GUI processes run as the agent's own non-root user — the same user
# hive-agent runs as (declared + home-chowned by harness-base.nix) — so # hive-agent runs as (declared + home-chowned by ./user.nix) — so
# weston, the wayland client, and the agent share one user session. # weston, the wayland client, and the agent share one user session.
# `hyperhive.user.name` is set per-agent by the meta-flake renderer. # `hyperhive.user.name` is set per-agent by the meta-flake renderer.
userName = config.hyperhive.user.name; userName = config.hyperhive.user.name;

View file

@ -280,7 +280,7 @@ in
# sandboxing always fails. Fall back to unsandboxed builds. # sandboxing always fails. Fall back to unsandboxed builds.
# Moot once every nix invocation in the container routes # Moot once every nix invocation in the container routes
# through the host daemon (the daemon governs sandboxing). # through the host daemon (the daemon governs sandboxing).
# See docs/gotchas.md and harness-base.nix. # See docs/gotchas.md and nix/agent-modules/default.nix.
nix.settings.sandbox-fallback = lib.mkForce true; nix.settings.sandbox-fallback = lib.mkForce true;
# Degrade to a local build when a remote builder is unreachable # Degrade to a local build when a remote builder is unreachable
# rather than failing the check. `fallback` is a client-side # rather than failing the check. `fallback` is a client-side

View file

@ -119,8 +119,8 @@ let
''; '';
# Per-bin split packages. Agent containers depend on the individual # Per-bin split packages. Agent containers depend on the individual
# bins they actually exec/PATH-need (see harness-base.nix) instead # bins they actually exec/PATH-need (see nix/agent-modules/packages.nix)
# of the `default` bundle — that keeps `hivectl` (dials the *host* # instead of the `default` bundle — that keeps `hivectl` (dials the *host*
# admin socket, unreachable from inside a container, drags in # admin socket, unreachable from inside a container, drags in
# `wireguard-tools`) and redundant binaries out of every agent's # `wireguard-tools`) and redundant binaries out of every agent's
# closure. # closure.