From fa944d12132d606dc97547a57017039f32da8751 Mon Sep 17 00:00:00 2001 From: atlas Date: Wed, 8 Jul 2026 22:47:36 +0200 Subject: [PATCH 1/4] fix(#2284): replace nixos-container kill with machinectl kill SIGKILL MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit nixos-container has no kill verb. The KillContainer priv request was calling nixos-container kill which always fails. Replace with: machinectl kill --signal=SIGKILL which sends SIGKILL to all processes in the container — the correct semantics for a forced shutdown (called after graceful stop has been attempted). Add a machinectl_run helper alongside container_run so callers stay consistent. --- hive-priv/src/main.rs | 34 +++++++++++++++++++++++++++++++++- hive-sh4re/src/priv_proto.rs | 3 ++- 2 files changed, 35 insertions(+), 2 deletions(-) diff --git a/hive-priv/src/main.rs b/hive-priv/src/main.rs index e57bbe23..cdb3f9df 100644 --- a/hive-priv/src/main.rs +++ b/hive-priv/src/main.rs @@ -172,7 +172,11 @@ async fn exec(req: PrivRequest, writer: &mut OwnedWriteHalf) -> Result<(String, PrivRequest::KillContainer { ref name } => { validate_container_name(name)?; - container_run(&["kill", &container_system_name(name)]).await + // nixos-container has no kill verb. Use machinectl to send SIGKILL + // to all processes in the container — the right semantics for a + // forced shutdown after a graceful stop has already been attempted. + let machine = container_system_name(name); + machinectl_run(&["kill", &machine, "--signal=SIGKILL"]).await } PrivRequest::UpdateContainer { ref name, stream } => { @@ -1026,6 +1030,34 @@ async fn container_run(args: &[&str]) -> Result<(String, String)> { Ok((stdout, stderr)) } +/// Invoke `machinectl` with the given args, log output to journald. +/// Used for operations that nixos-container doesn't expose (e.g. sending +/// signals to running containers). +async fn machinectl_run(args: &[&str]) -> Result<(String, String)> { + let out = Command::new("machinectl") + .args(args) + .output() + .await + .context("invoke machinectl")?; + let stdout = String::from_utf8_lossy(&out.stdout).into_owned(); + let stderr = String::from_utf8_lossy(&out.stderr).into_owned(); + for line in stdout.lines() { + tracing::info!(target: "machinectl", "{line}"); + } + for line in stderr.lines() { + tracing::warn!(target: "machinectl", "{line}"); + } + if !out.status.success() { + bail!( + "machinectl {} failed ({}): {}", + args.join(" "), + out.status, + stderr.trim() + ); + } + Ok((stdout, stderr)) +} + /// Invoke `nixos-container` with the given args and forward output lines /// to the caller as `PrivEvent::Line` messages in real time, logging each /// line to journald as it arrives. Returns `(String::new(), String::new())` diff --git a/hive-sh4re/src/priv_proto.rs b/hive-sh4re/src/priv_proto.rs index 49fb99f0..618f312c 100644 --- a/hive-sh4re/src/priv_proto.rs +++ b/hive-sh4re/src/priv_proto.rs @@ -230,7 +230,8 @@ pub enum PrivRequest { /// `nixos-container stop ` StopContainer { name: String }, - /// `nixos-container kill ` + /// `machinectl kill --signal=SIGKILL` — force-kills all processes + /// in the container. nixos-container has no kill verb. KillContainer { name: String }, /// `nixos-container update --flake ` From 64eddfd0b6f649642f68d4be9629e0fd72e35bc0 Mon Sep 17 00:00:00 2001 From: atlas Date: Sat, 4 Jul 2026 18:54:49 +0200 Subject: [PATCH 2/4] feat(#2228): add XDG icon set and .desktop entries for hyperhive processes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds hive-xdg-icons package (nix/packages/hive-xdg-icons.nix) that rasterizes the branding SVG to all standard hicolor sizes (16–256px) and installs /usr/share/pixmaps/hyperhive.png as a flat fallback. Ships .desktop entries for hive-c0re and hive-ag3nt with NoDisplay=true so desktop environments can match running processes to their icon without cluttering the application launcher. Narrow drv input: only ./branding/hyperhive.svg, so unrelated source changes don't bust the cache. Wired into environment.systemPackages in hive-c0re.nix (host side) so the icons are present wherever hive-c0re is deployed. Closes #2228 --- flake.nix | 7 +++ nix/modules/hive-c0re.nix | 4 ++ nix/packages/hive-xdg-icons.nix | 85 +++++++++++++++++++++++++++++++++ 3 files changed, 96 insertions(+) create mode 100644 nix/packages/hive-xdg-icons.nix diff --git a/flake.nix b/flake.nix index 5213729a..8aca61c7 100644 --- a/flake.nix +++ b/flake.nix @@ -236,6 +236,12 @@ # nix/reference-docs.nix. (`docs` above is the auto-generated # nix-options reference, a different artifact.) reference-docs = pkgs.callPackage ./nix/reference-docs.nix { }; + # XDG icon set + .desktop entries for hyperhive processes. + # Narrow input: only the branding SVG, so unrelated source changes + # don't bust this derivation's cache. + xdg-icons = pkgs.callPackage ./nix/packages/hive-xdg-icons.nix { + hyperhiveSvg = ./branding/hyperhive.svg; + }; # Pre-built per-container system closures. Exposed as packages # so operators can `nix build .#agent-base-toplevel` (or wire # them into their host system closure via the @@ -298,6 +304,7 @@ hyperhivePackage = system: self.packages.${system}.default; hyperhiveFrontend = system: self.packages.${system}.frontend; hyperhiveAssets = system: self.packages.${system}.assets; + hyperhiveXdgIcons = system: self.packages.${system}.xdg-icons; hyperhiveFlake = "${hyperhiveFlakeSource}"; # Narrow docs/ source, threaded as its own meta-flake input so # doc edits don't re-hash the whole flake source. diff --git a/nix/modules/hive-c0re.nix b/nix/modules/hive-c0re.nix index 8d748f8f..bea4c230 100644 --- a/nix/modules/hive-c0re.nix +++ b/nix/modules/hive-c0re.nix @@ -4,6 +4,7 @@ hyperhiveAssets, hyperhiveFlake, hyperhiveDocs, + hyperhiveXdgIcons, agentBaseToplevel, managerToplevel, }: @@ -794,6 +795,9 @@ in environment.systemPackages = [ cfg.package pkgs.git + # XDG icons + .desktop entries so desktop environments can match + # hyperhive processes to their icon (task managers, CPU monitors, etc.). + (hyperhiveXdgIcons pkgs.stdenv.hostPlatform.system) ]; # Serve config at a stable /etc path so hive-c0re's ExecStart diff --git a/nix/packages/hive-xdg-icons.nix b/nix/packages/hive-xdg-icons.nix new file mode 100644 index 00000000..18fdd344 --- /dev/null +++ b/nix/packages/hive-xdg-icons.nix @@ -0,0 +1,85 @@ +{ + stdenv, + librsvg, + # Absolute path to the hyperhive.svg source so this derivation's input + # hash is narrow: a change to any other source file does NOT bust it. + hyperhiveSvg, +}: + +# XDG icon set + .desktop entries for hyperhive processes so desktop +# environments can match running processes to icons (task managers, CPU +# monitors, etc.). +# +# Output layout: +# $out/share/icons/hicolor/x/apps/hyperhive.png (N = 16,32,48,64,128,256) +# $out/share/pixmaps/hyperhive.png (48px fallback) +# $out/share/applications/hive-c0re.desktop +# $out/share/applications/hive-ag3nt.desktop +stdenv.mkDerivation { + pname = "hive-xdg-icons"; + version = "0.1.0"; + + # No source tree — everything is built from the single SVG path. + dontUnpack = true; + + nativeBuildInputs = [ librsvg ]; + + buildPhase = '' + runHook preBuild + mkdir -p icons + for size in 16 32 48 64 128 256; do + rsvg-convert --width "$size" --height "$size" \ + -o "icons/hyperhive-''${size}.png" \ + ${hyperhiveSvg} + done + runHook postBuild + ''; + + installPhase = '' + runHook preInstall + # Per-size hicolor tree + for size in 16 32 48 64 128 256; do + mkdir -p "$out/share/icons/hicolor/''${size}x''${size}/apps" + cp "icons/hyperhive-''${size}.png" \ + "$out/share/icons/hicolor/''${size}x''${size}/apps/hyperhive.png" + done + # Flat pixmaps fallback (48px) + mkdir -p "$out/share/pixmaps" + cp icons/hyperhive-48.png "$out/share/pixmaps/hyperhive.png" + + # .desktop entries — NoDisplay so they don't show up in app launchers + # but are still discovered by process-to-icon matchers (GNOME, etc.). + mkdir -p "$out/share/applications" + cat > "$out/share/applications/hive-c0re.desktop" < "$out/share/applications/hive-ag3nt.desktop" < Date: Sat, 4 Jul 2026 19:48:33 +0200 Subject: [PATCH 3/4] fix: add hyperhiveXdgIcons stub to nix/docs eval (fixes packages.docs check) --- nix/docs/default.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/nix/docs/default.nix b/nix/docs/default.nix index e03df075..fdcf36ea 100644 --- a/nix/docs/default.nix +++ b/nix/docs/default.nix @@ -48,6 +48,7 @@ let hyperhiveAssets = _system: pkgs.emptyDirectory; hyperhiveFlake = ""; hyperhiveDocs = ""; + hyperhiveXdgIcons = _system: pkgs.emptyFile; agentBaseToplevel = pkgs.emptyFile; managerToplevel = pkgs.emptyFile; }) From 39af2bad5dfc2bdf1d4b9b1fc877df9b3bda2736 Mon Sep 17 00:00:00 2001 From: atlas Date: Wed, 8 Jul 2026 21:03:53 +0200 Subject: [PATCH 4/4] style: nix fmt hive-xdg-icons.nix (treefmt) --- nix/packages/hive-xdg-icons.nix | 76 ++++++++++++++++----------------- 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/nix/packages/hive-xdg-icons.nix b/nix/packages/hive-xdg-icons.nix index 18fdd344..fae5ed2e 100644 --- a/nix/packages/hive-xdg-icons.nix +++ b/nix/packages/hive-xdg-icons.nix @@ -36,45 +36,45 @@ stdenv.mkDerivation { ''; installPhase = '' - runHook preInstall - # Per-size hicolor tree - for size in 16 32 48 64 128 256; do - mkdir -p "$out/share/icons/hicolor/''${size}x''${size}/apps" - cp "icons/hyperhive-''${size}.png" \ - "$out/share/icons/hicolor/''${size}x''${size}/apps/hyperhive.png" - done - # Flat pixmaps fallback (48px) - mkdir -p "$out/share/pixmaps" - cp icons/hyperhive-48.png "$out/share/pixmaps/hyperhive.png" + runHook preInstall + # Per-size hicolor tree + for size in 16 32 48 64 128 256; do + mkdir -p "$out/share/icons/hicolor/''${size}x''${size}/apps" + cp "icons/hyperhive-''${size}.png" \ + "$out/share/icons/hicolor/''${size}x''${size}/apps/hyperhive.png" + done + # Flat pixmaps fallback (48px) + mkdir -p "$out/share/pixmaps" + cp icons/hyperhive-48.png "$out/share/pixmaps/hyperhive.png" - # .desktop entries — NoDisplay so they don't show up in app launchers - # but are still discovered by process-to-icon matchers (GNOME, etc.). - mkdir -p "$out/share/applications" - cat > "$out/share/applications/hive-c0re.desktop" < "$out/share/applications/hive-ag3nt.desktop" < "$out/share/applications/hive-c0re.desktop" < "$out/share/applications/hive-ag3nt.desktop" <