module: thread hyperhive package directly — operators don't apply overlays
This commit is contained in:
parent
8dc9b24934
commit
4f91dfef99
6 changed files with 23 additions and 25 deletions
|
|
@ -63,10 +63,6 @@ Minimal `flake.nix` for a host that runs hive-c0re:
|
||||||
modules = [
|
modules = [
|
||||||
hyperhive.nixosModules.hive-c0re
|
hyperhive.nixosModules.hive-c0re
|
||||||
({ ... }: {
|
({ ... }: {
|
||||||
nixpkgs.overlays = [
|
|
||||||
hyperhive.overlays.default
|
|
||||||
hyperhive.overlays.claude-unstable
|
|
||||||
];
|
|
||||||
services.hive-c0re = {
|
services.hive-c0re = {
|
||||||
enable = true;
|
enable = true;
|
||||||
hyperhiveFlake = "${hyperhive}";
|
hyperhiveFlake = "${hyperhive}";
|
||||||
|
|
@ -102,5 +98,6 @@ nix flake update --update-input hyperhive
|
||||||
sudo nixos-rebuild switch --flake .#<host>
|
sudo nixos-rebuild switch --flake .#<host>
|
||||||
```
|
```
|
||||||
|
|
||||||
The host config also needs `hyperhive.overlays.default` applied — the
|
No overlays on the host's `pkgs` — the module pulls hive-c0re's package
|
||||||
module's default `package = pkgs.hyperhive` requires the overlay.
|
straight from `hyperhive.packages.<system>.default`. Just import the
|
||||||
|
module and the service is wired up.
|
||||||
|
|
|
||||||
11
flake.nix
11
flake.nix
|
|
@ -79,8 +79,17 @@
|
||||||
|
|
||||||
nixosModules = {
|
nixosModules = {
|
||||||
agent-base = ./nix/templates/agent-base.nix;
|
agent-base = ./nix/templates/agent-base.nix;
|
||||||
hive-c0re = ./nix/modules/hive-c0re.nix;
|
|
||||||
manager = ./nix/templates/manager.nix;
|
manager = ./nix/templates/manager.nix;
|
||||||
|
# The hive-c0re module wants `pkgs.hyperhive` for its default
|
||||||
|
# `services.hive-c0re.package`. To avoid making operators apply an
|
||||||
|
# overlay (which would also pollute their host pkgs with our
|
||||||
|
# build), we thread the package straight from this flake's
|
||||||
|
# `packages.<system>.default` via a `hyperhivePackage` argument.
|
||||||
|
# The `claude-unstable` overlay only matters inside our container
|
||||||
|
# builds (already applied internally in `nixosConfigurations`).
|
||||||
|
hive-c0re = import ./nix/modules/hive-c0re.nix {
|
||||||
|
hyperhivePackage = system: self.packages.${system}.default;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
nixosConfigurations =
|
nixosConfigurations =
|
||||||
|
|
|
||||||
|
|
@ -66,11 +66,7 @@ impl From<hive_sh4re::ManagerResponse> for SocketReply {
|
||||||
/// Format helper for "send-like" tools (anything that expects an `Ok`).
|
/// Format helper for "send-like" tools (anything that expects an `Ok`).
|
||||||
/// `tool` and `ok_msg` only appear in the result string; they don't change
|
/// `tool` and `ok_msg` only appear in the result string; they don't change
|
||||||
/// behavior.
|
/// behavior.
|
||||||
pub fn format_ack(
|
pub fn format_ack(resp: Result<SocketReply, anyhow::Error>, tool: &str, ok_msg: String) -> String {
|
||||||
resp: Result<SocketReply, anyhow::Error>,
|
|
||||||
tool: &str,
|
|
||||||
ok_msg: String,
|
|
||||||
) -> String {
|
|
||||||
match resp {
|
match resp {
|
||||||
Ok(SocketReply::Ok) => ok_msg,
|
Ok(SocketReply::Ok) => ok_msg,
|
||||||
Ok(SocketReply::Err(m)) => format!("{tool} failed: {m}"),
|
Ok(SocketReply::Err(m)) => format!("{tool} failed: {m}"),
|
||||||
|
|
@ -274,7 +270,10 @@ impl ManagerServer {
|
||||||
|
|
||||||
/// Helper: issue any `ManagerRequest`, convert the reply through
|
/// Helper: issue any `ManagerRequest`, convert the reply through
|
||||||
/// `SocketReply`. Manager tools that just need an `Ok` ack share this.
|
/// `SocketReply`. Manager tools that just need an `Ok` ack share this.
|
||||||
async fn dispatch(&self, req: hive_sh4re::ManagerRequest) -> Result<SocketReply, anyhow::Error> {
|
async fn dispatch(
|
||||||
|
&self,
|
||||||
|
req: hive_sh4re::ManagerRequest,
|
||||||
|
) -> Result<SocketReply, anyhow::Error> {
|
||||||
client::request::<_, hive_sh4re::ManagerResponse>(&self.socket, &req)
|
client::request::<_, hive_sh4re::ManagerResponse>(&self.socket, &req)
|
||||||
.await
|
.await
|
||||||
.map(SocketReply::from)
|
.map(SocketReply::from)
|
||||||
|
|
|
||||||
|
|
@ -295,8 +295,4 @@ fn html_escape(s: &str) -> String {
|
||||||
.replace('"', """)
|
.replace('"', """)
|
||||||
}
|
}
|
||||||
|
|
||||||
const STYLE: &str = concat!(
|
const STYLE: &str = concat!("<style>\n", include_str!("../assets/agent.css"), "</style>",);
|
||||||
"<style>\n",
|
|
||||||
include_str!("../assets/agent.css"),
|
|
||||||
"</style>",
|
|
||||||
);
|
|
||||||
|
|
|
||||||
|
|
@ -312,11 +312,7 @@ fn render_diff_lines(diff: &str) -> String {
|
||||||
Some(b'-') => "diff-del",
|
Some(b'-') => "diff-del",
|
||||||
_ => "diff-ctx",
|
_ => "diff-ctx",
|
||||||
};
|
};
|
||||||
let _ = writeln!(
|
let _ = writeln!(out, "<span class=\"{cls}\">{}</span>", html_escape(raw),);
|
||||||
out,
|
|
||||||
"<span class=\"{cls}\">{}</span>",
|
|
||||||
html_escape(raw),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
out
|
out
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
{ hyperhivePackage }:
|
||||||
{
|
{
|
||||||
pkgs,
|
pkgs,
|
||||||
lib,
|
lib,
|
||||||
|
|
@ -12,8 +13,8 @@ in
|
||||||
enable = lib.mkEnableOption "hive-c0re — hyperhive coordinator daemon";
|
enable = lib.mkEnableOption "hive-c0re — hyperhive coordinator daemon";
|
||||||
package = lib.mkOption {
|
package = lib.mkOption {
|
||||||
type = lib.types.package;
|
type = lib.types.package;
|
||||||
default = pkgs.hyperhive;
|
default = hyperhivePackage pkgs.stdenv.hostPlatform.system;
|
||||||
defaultText = lib.literalExpression "pkgs.hyperhive";
|
defaultText = lib.literalExpression "hyperhive.packages.\${system}.default";
|
||||||
description = "Package that provides /bin/hive-c0re.";
|
description = "Package that provides /bin/hive-c0re.";
|
||||||
};
|
};
|
||||||
hyperhiveFlake = lib.mkOption {
|
hyperhiveFlake = lib.mkOption {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue