refactor: thread agent packages via option, drop overlay and forge-tools shim

This commit is contained in:
müde 2026-07-13 21:43:26 +02:00
commit 281667d5a8
13 changed files with 139 additions and 168 deletions

153
flake.nix
View file

@ -67,80 +67,78 @@
}
);
overlays = {
default = final: prev: {
hyperhive = self.packages.${prev.stdenv.hostPlatform.system}.default;
# Per-binary daemon/harness/MCP-server packages, exposed via the
# overlay so container nix evaluations can depend on exactly the
# bin(s) they need instead of the full `hyperhive` bundle — see
# `packages.<system>.hive-*` and their use in `harness-base.nix`.
hive-c0re = self.packages.${prev.stdenv.hostPlatform.system}.hive-c0re;
hive-priv = self.packages.${prev.stdenv.hostPlatform.system}.hive-priv;
hive-agent = self.packages.${prev.stdenv.hostPlatform.system}.hive-agent;
hive-agent-mcp = self.packages.${prev.stdenv.hostPlatform.system}.hive-agent-mcp;
hive-agent-wake = self.packages.${prev.stdenv.hostPlatform.system}.hive-agent-wake;
hive-bash-daemon = self.packages.${prev.stdenv.hostPlatform.system}.hive-bash-daemon;
hive-bash-mcp = self.packages.${prev.stdenv.hostPlatform.system}.hive-bash-mcp;
hive-matrix-daemon = self.packages.${prev.stdenv.hostPlatform.system}.hive-matrix-daemon;
hive-matrix-mcp = self.packages.${prev.stdenv.hostPlatform.system}.hive-matrix-mcp;
hive-metric = self.packages.${prev.stdenv.hostPlatform.system}.hive-metric;
# Bundled frontend dist (see nix/packages/frontend.nix). Output
# is $out/{dashboard,agent}/; consumers pick the surface they
# need. Exposed via the overlay so containers' nix evaluations
# can reach it as `pkgs.hyperhive-frontend` once the overlay
# is applied (manager + agent containers both apply it via
# `mkContainer` further down).
hyperhive-frontend = self.packages.${prev.stdenv.hostPlatform.system}.frontend;
# Static runtime assets. Exposed alongside the binary
# so the harness module can wire $HIVE_ASSETS_DIR straight
# to `${pkgs.hyperhive-assets}/share/hyperhive`.
hyperhive-assets = self.packages.${prev.stdenv.hostPlatform.system}.assets;
# Standalone docs/ tree (see nix/packages/reference-docs.nix).
# Exposed via the overlay so the harness module can build the
# in-container agent docs dir from it.
hyperhive-docs = self.packages.${prev.stdenv.hostPlatform.system}.reference-docs;
};
};
nixosModules = {
agent-base = ./nix/templates/agent-base.nix;
ruth = ./nix/templates/manager.nix;
# The full host stack (nix/modules/default.nix aggregator) plus
# the package/source wiring from this flake. The wiring is a
# plain config module setting the `services.hyperhive.c0re.*`
# package options via `lib.mkDefault` — no overlay involved, and
# an operator override still wins. Intended usage:
#
# imports = [ hyperhive.nixosModules.default ];
# services.hyperhive.enable = true;
#
default =
{ lib, pkgs, ... }:
{
imports = [ ./nix/modules ];
services.hyperhive.c0re = {
package = lib.mkDefault self.packages.${pkgs.stdenv.hostPlatform.system}.default;
frontend = lib.mkDefault self.packages.${pkgs.stdenv.hostPlatform.system}.frontend;
assets = lib.mkDefault self.packages.${pkgs.stdenv.hostPlatform.system}.assets;
xdgIcons = lib.mkDefault self.packages.${pkgs.stdenv.hostPlatform.system}.xdg-icons;
hyperhiveFlake = lib.mkDefault "${sources.hyperhiveFlakeSource}";
# Narrow docs/ source, threaded as its own meta-flake input
# so doc edits don't re-hash the whole flake source.
hyperhiveDocs = lib.mkDefault "${sources.hyperhiveDocsSource}";
# Per-container toplevels — wired into
# `system.extraDependencies` when
# `services.hyperhive.c0re.preBuildAgentTemplates` is on so
# the host system closure pre-fetches the heavy build
# inputs. x86_64-linux only (nixosConfigurations are
# hardcoded to that system); the gate keeps aarch64 hosts
# from pulling them in via cross-build.
agentBaseToplevel = lib.mkDefault self.packages.x86_64-linux.agent-base-toplevel;
managerToplevel = lib.mkDefault self.packages.x86_64-linux.ruth-toplevel;
nixosModules =
let
# Package wiring for agent containers — the harness modules
# consume hyperhive's own packages via the `hyperhive.packages`
# option (see nix/templates/harness/packages.nix); no overlay.
# `mkDefault` so a per-agent override of an individual key wins.
agentPackages =
{ lib, pkgs, ... }:
{
hyperhive.packages = lib.mkDefault {
inherit (self.packages.${pkgs.stdenv.hostPlatform.system})
hive-agent
hive-agent-mcp
hive-agent-wake
hive-bash-daemon
hive-bash-mcp
hive-forge
hive-matrix-daemon
hive-matrix-mcp
hive-metric
assets
frontend
reference-docs
;
};
};
};
hive-ci = ./nix/modules/hive-ci.nix;
hive-forge = ./nix/modules/hive-forge.nix;
};
in
{
agent-base.imports = [
./nix/templates/agent-base.nix
agentPackages
];
ruth.imports = [
./nix/templates/manager.nix
agentPackages
];
# The full host stack (nix/modules/default.nix aggregator) plus
# the package/source wiring from this flake. The wiring is a
# plain config module setting the `services.hyperhive.c0re.*`
# package options via `lib.mkDefault` — no overlay involved, and
# an operator override still wins. Intended usage:
#
# imports = [ hyperhive.nixosModules.default ];
# services.hyperhive.enable = true;
#
default =
{ lib, pkgs, ... }:
{
imports = [ ./nix/modules ];
services.hyperhive.c0re = {
package = lib.mkDefault self.packages.${pkgs.stdenv.hostPlatform.system}.default;
frontend = lib.mkDefault self.packages.${pkgs.stdenv.hostPlatform.system}.frontend;
assets = lib.mkDefault self.packages.${pkgs.stdenv.hostPlatform.system}.assets;
xdgIcons = lib.mkDefault self.packages.${pkgs.stdenv.hostPlatform.system}.xdg-icons;
hyperhiveFlake = lib.mkDefault "${sources.hyperhiveFlakeSource}";
# Narrow docs/ source, threaded as its own meta-flake input
# so doc edits don't re-hash the whole flake source.
hyperhiveDocs = lib.mkDefault "${sources.hyperhiveDocsSource}";
# Per-container toplevels — wired into
# `system.extraDependencies` when
# `services.hyperhive.c0re.preBuildAgentTemplates` is on so
# the host system closure pre-fetches the heavy build
# inputs. x86_64-linux only (nixosConfigurations are
# hardcoded to that system); the gate keeps aarch64 hosts
# from pulling them in via cross-build.
agentBaseToplevel = lib.mkDefault self.packages.x86_64-linux.agent-base-toplevel;
managerToplevel = lib.mkDefault self.packages.x86_64-linux.ruth-toplevel;
};
};
hive-ci = ./nix/modules/hive-ci.nix;
hive-forge = ./nix/modules/hive-forge.nix;
};
nixosConfigurations =
let
@ -148,14 +146,7 @@
module:
nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
module
{
nixpkgs.overlays = [
self.overlays.default
];
}
];
modules = [ module ];
};
in
{