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 = [
|
||||
hyperhive.nixosModules.hive-c0re
|
||||
({ ... }: {
|
||||
nixpkgs.overlays = [
|
||||
hyperhive.overlays.default
|
||||
hyperhive.overlays.claude-unstable
|
||||
];
|
||||
services.hive-c0re = {
|
||||
enable = true;
|
||||
hyperhiveFlake = "${hyperhive}";
|
||||
|
|
@ -102,5 +98,6 @@ nix flake update --update-input hyperhive
|
|||
sudo nixos-rebuild switch --flake .#<host>
|
||||
```
|
||||
|
||||
The host config also needs `hyperhive.overlays.default` applied — the
|
||||
module's default `package = pkgs.hyperhive` requires the overlay.
|
||||
No overlays on the host's `pkgs` — the module pulls hive-c0re's package
|
||||
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 = {
|
||||
agent-base = ./nix/templates/agent-base.nix;
|
||||
hive-c0re = ./nix/modules/hive-c0re.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 =
|
||||
|
|
|
|||
|
|
@ -66,11 +66,7 @@ impl From<hive_sh4re::ManagerResponse> for SocketReply {
|
|||
/// 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
|
||||
/// behavior.
|
||||
pub fn format_ack(
|
||||
resp: Result<SocketReply, anyhow::Error>,
|
||||
tool: &str,
|
||||
ok_msg: String,
|
||||
) -> String {
|
||||
pub fn format_ack(resp: Result<SocketReply, anyhow::Error>, tool: &str, ok_msg: String) -> String {
|
||||
match resp {
|
||||
Ok(SocketReply::Ok) => ok_msg,
|
||||
Ok(SocketReply::Err(m)) => format!("{tool} failed: {m}"),
|
||||
|
|
@ -274,7 +270,10 @@ impl ManagerServer {
|
|||
|
||||
/// Helper: issue any `ManagerRequest`, convert the reply through
|
||||
/// `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)
|
||||
.await
|
||||
.map(SocketReply::from)
|
||||
|
|
|
|||
|
|
@ -295,8 +295,4 @@ fn html_escape(s: &str) -> String {
|
|||
.replace('"', """)
|
||||
}
|
||||
|
||||
const STYLE: &str = concat!(
|
||||
"<style>\n",
|
||||
include_str!("../assets/agent.css"),
|
||||
"</style>",
|
||||
);
|
||||
const STYLE: &str = concat!("<style>\n", include_str!("../assets/agent.css"), "</style>",);
|
||||
|
|
|
|||
|
|
@ -312,11 +312,7 @@ fn render_diff_lines(diff: &str) -> String {
|
|||
Some(b'-') => "diff-del",
|
||||
_ => "diff-ctx",
|
||||
};
|
||||
let _ = writeln!(
|
||||
out,
|
||||
"<span class=\"{cls}\">{}</span>",
|
||||
html_escape(raw),
|
||||
);
|
||||
let _ = writeln!(out, "<span class=\"{cls}\">{}</span>", html_escape(raw),);
|
||||
}
|
||||
out
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
{ hyperhivePackage }:
|
||||
{
|
||||
pkgs,
|
||||
lib,
|
||||
|
|
@ -12,8 +13,8 @@ in
|
|||
enable = lib.mkEnableOption "hive-c0re — hyperhive coordinator daemon";
|
||||
package = lib.mkOption {
|
||||
type = lib.types.package;
|
||||
default = pkgs.hyperhive;
|
||||
defaultText = lib.literalExpression "pkgs.hyperhive";
|
||||
default = hyperhivePackage pkgs.stdenv.hostPlatform.system;
|
||||
defaultText = lib.literalExpression "hyperhive.packages.\${system}.default";
|
||||
description = "Package that provides /bin/hive-c0re.";
|
||||
};
|
||||
hyperhiveFlake = lib.mkOption {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue