the meta flake takes docs from the pinned hyperhive input
This commit is contained in:
parent
bb13909d8e
commit
daf38e4c55
16 changed files with 29 additions and 197 deletions
|
|
@ -9,7 +9,7 @@
|
|||
{
|
||||
options.services.hyperhive.agent.docs.enable = lib.mkEnableOption ''
|
||||
make the hyperhive reference docs (the repo `docs/` tree, shipped
|
||||
read-only as the standalone `hyperhive-docs` derivation) available
|
||||
read-only as the `reference-docs` package) available
|
||||
in-container. When enabled the harness exposes the docs dir to claude
|
||||
via `claude --add-dir`, so the markdown is readable at
|
||||
`$HIVE_DOCS_DIR/`, and appends a single pointer sentence to the agent's
|
||||
|
|
@ -26,11 +26,7 @@
|
|||
Store path of the reference-docs tree exposed at `$HIVE_DOCS_DIR`
|
||||
when `services.hyperhive.agent.docs.enable` is set. Defaults to the flake's
|
||||
`reference-docs` package (the `nix/packages/reference-docs.nix`
|
||||
build) so a standalone container build from a full checkout
|
||||
works unchanged. The generated meta flake overrides this with the
|
||||
narrow `hyperhive-docs` flake input so a doc edit only
|
||||
re-locks that input instead of rebuilding the container from a
|
||||
re-hashed `hyperhive` source.
|
||||
build), which the meta flake's pinned `hyperhive` input provides.
|
||||
'';
|
||||
};
|
||||
|
||||
|
|
@ -40,9 +36,7 @@
|
|||
# `--add-dir` so the docs are readable, and appends a single
|
||||
# pointer sentence to the system prompt
|
||||
# (hive-agent::prompt::render) telling the agent the docs exist.
|
||||
# Source is `services.hyperhive.agent.docs.source` (the narrow `hyperhive-docs`
|
||||
# meta-flake input, or `pkgs.hyperhive-docs` for standalone
|
||||
# builds). See hive-agent::turn.
|
||||
# Source is `services.hyperhive.agent.docs.source` (default: the `reference-docs` package). See hive-agent::turn.
|
||||
HIVE_DOCS_DIR = "${config.services.hyperhive.agent.docs.source}";
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
# The swarm builder's build check: one agent config on hyperhive's agent base,
|
||||
# composed the way a hive's meta flake composes it, minus the values a hive
|
||||
# adds (its CA, claude-code path and ports). The docs source is set the way the
|
||||
# meta flake sets it: `hyperhive`'s source has no `docs/`, so the default
|
||||
# `docs.source` fails to evaluate.
|
||||
# adds (its CA, claude-code path and ports).
|
||||
#
|
||||
# Every input is replaced at build time with `--override-input`
|
||||
# (swarm-builder/src/nix_build.rs), so the URLs below are never fetched and
|
||||
|
|
@ -14,25 +12,19 @@
|
|||
nixpkgs.url = "flake:nixpkgs";
|
||||
hyperhive.url = "flake:hyperhive";
|
||||
hyperhive.inputs.nixpkgs.follows = "nixpkgs";
|
||||
hyperhive-docs.url = "flake:hyperhive-docs";
|
||||
hyperhive-docs.flake = false;
|
||||
agent.url = "flake:agent";
|
||||
};
|
||||
|
||||
outputs =
|
||||
{
|
||||
hyperhive,
|
||||
hyperhive-docs,
|
||||
agent,
|
||||
...
|
||||
}:
|
||||
{
|
||||
packages.x86_64-linux.check =
|
||||
(hyperhive.nixosConfigurations.agent-base.extendModules {
|
||||
modules = [
|
||||
agent.nixosModules.default
|
||||
{ services.hyperhive.agent.docs.source = hyperhive-docs.outPath; }
|
||||
];
|
||||
modules = [ agent.nixosModules.default ];
|
||||
}).config.system.build.toplevel;
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -96,7 +96,6 @@ let
|
|||
# c0re binary itself changes.
|
||||
serveConfigJson = builtins.toJSON {
|
||||
hyperhive_flake = cfg.hyperhiveFlake;
|
||||
hyperhive_docs_flake = cfg.hyperhiveDocs;
|
||||
hyperhive_rev = cfg.hyperhiveRev;
|
||||
# The `claude-code` every agent runs, or null for "each agent keeps
|
||||
# the one out of its own nixpkgs". `builtins.toJSON` serialises a
|
||||
|
|
|
|||
|
|
@ -16,6 +16,10 @@
|
|||
(lib.mkRemovedOptionModule [ "services" "hyperhive" "c0re" "managerToplevel" ] ''
|
||||
Every agent, ruth included, builds from `agentBaseToplevel`. Remove this definition.
|
||||
'')
|
||||
(lib.mkRemovedOptionModule [ "services" "hyperhive" "c0re" "hyperhiveDocs" ] ''
|
||||
Agents take their reference docs from the pinned `hyperhive` input, which
|
||||
carries `docs/`. Remove this definition.
|
||||
'')
|
||||
];
|
||||
|
||||
options.services.hyperhive.c0re = {
|
||||
|
|
@ -90,18 +94,6 @@
|
|||
hive-c0re refuses to render the meta flake.
|
||||
'';
|
||||
};
|
||||
hyperhiveDocs = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
defaultText = lib.literalMD "the docs/ tree's own store path";
|
||||
description = ''
|
||||
URL of the narrow `docs/` source (no fragment). Inlined into the
|
||||
generated meta `flake.nix` at `inputs.hyperhive-docs.url` and
|
||||
threaded to each agent as `services.hyperhive.agent.docs.source`, from which the
|
||||
harness resolves `$HIVE_DOCS_DIR`. Its own store path — separate
|
||||
from `hyperhiveFlake` — so a doc edit only re-locks this input
|
||||
instead of rebuilding every agent container.
|
||||
'';
|
||||
};
|
||||
agentBaseToplevel = lib.mkOption {
|
||||
type = lib.types.package;
|
||||
defaultText = lib.literalExpression "hyperhive.packages.x86_64-linux.agent-base-toplevel";
|
||||
|
|
|
|||
|
|
@ -89,11 +89,9 @@ let
|
|||
# The `nix` the host daemon runs, so client and daemon speak one protocol.
|
||||
nix = config.nix.package;
|
||||
|
||||
# Strings, not paths: all three are already store paths, and the flake
|
||||
# references the daemon passes must be the ones a hive's meta flake names.
|
||||
# Strings, not paths: both are already store paths.
|
||||
hyperhiveFlake = hyperhiveCfg.c0re.hyperhiveFlake;
|
||||
nixpkgsFlake = hyperhiveCfg.c0re.nixpkgsFlake;
|
||||
docsFlake = hyperhiveCfg.c0re.hyperhiveDocs;
|
||||
|
||||
privateNetwork = true;
|
||||
in
|
||||
|
|
@ -254,7 +252,6 @@ in
|
|||
SWARM_BUILDER_CHECK_FLAKE = "${../builder/check-flake}";
|
||||
SWARM_BUILDER_HYPERHIVE_FLAKE = hyperhiveFlake;
|
||||
SWARM_BUILDER_NIXPKGS_FLAKE = nixpkgsFlake;
|
||||
SWARM_BUILDER_HYPERHIVE_DOCS_FLAKE = docsFlake;
|
||||
SWARM_BUILDER_FORGE_URL = "https://${forgeCfg.domain}";
|
||||
SWARM_BUILDER_CONFIG_ORG = "agent-configs";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,8 +51,7 @@ let
|
|||
|
||||
# The check flake on the inputs the builder's unit names, called as
|
||||
# `nix build` calls it. `hyperhive` is entered through the filtered source's
|
||||
# own `flake.nix`, so its agent base sees the tree without `docs/` that a
|
||||
# real build gets; `self`'s own agent base would find `docs/` here.
|
||||
# own `flake.nix`.
|
||||
builderCheck =
|
||||
agentModule:
|
||||
let
|
||||
|
|
@ -69,7 +68,6 @@ let
|
|||
in
|
||||
((import "${env.SWARM_BUILDER_CHECK_FLAKE}/flake.nix").outputs {
|
||||
inherit hyperhive;
|
||||
hyperhive-docs.outPath = env.SWARM_BUILDER_HYPERHIVE_DOCS_FLAKE;
|
||||
agent.nixosModules.default = agentModule;
|
||||
}).packages.x86_64-linux.check;
|
||||
|
||||
|
|
@ -136,11 +134,10 @@ let
|
|||
}
|
||||
{
|
||||
# The check builds on the sources this host was deployed with, so a green check means
|
||||
# the same hyperhive, docs and nixpkgs base.
|
||||
name = "the builder builds on the hyperhive, docs and nixpkgs this host's hives use";
|
||||
# the same hyperhive and nixpkgs base.
|
||||
name = "the builder builds on the hyperhive and nixpkgs this host was deployed with";
|
||||
ok =
|
||||
env.SWARM_BUILDER_HYPERHIVE_FLAKE == withBuilder.services.hyperhive.c0re.hyperhiveFlake
|
||||
&& env.SWARM_BUILDER_HYPERHIVE_DOCS_FLAKE == withBuilder.services.hyperhive.c0re.hyperhiveDocs
|
||||
&& env.SWARM_BUILDER_NIXPKGS_FLAKE == withBuilder.services.hyperhive.c0re.nixpkgsFlake
|
||||
&& lib.hasSuffix "-check-flake" env.SWARM_BUILDER_CHECK_FLAKE
|
||||
&& env.SWARM_BUILDER_CONFIG_ORG == "agent-configs"
|
||||
|
|
|
|||
|
|
@ -4,23 +4,10 @@
|
|||
# (crane's cargo-source filter — see ./rust.nix).
|
||||
{ lib }:
|
||||
{
|
||||
# Filtered view of this repo handed to hive-c0re as the `hyperhive`
|
||||
# meta-flake input. Drops files no nix or cargo derivation reads —
|
||||
# shell helper scripts and root-level markdown — so editing them
|
||||
# does NOT change the store path and therefore does NOT force a
|
||||
# rebuild of every agent container.
|
||||
#
|
||||
# Dropped: scripts/, docs/, root-level *.md (README/AGENTS/TODO/…).
|
||||
# Kept (build needs them): .nix, .rs, Cargo.*, branding/,
|
||||
# frontend/, prompts/, flake.lock. docs/ is deliberately dropped:
|
||||
# it is shipped to agent containers as its OWN narrow meta-flake
|
||||
# input (`hyperhiveDocsSource`, below), threaded through hive-c0re
|
||||
# → the meta flake → `services.hyperhive.agent.docs.source`. Keeping docs/ out of
|
||||
# THIS source means a doc edit only re-hashes the docs input (a
|
||||
# cheap re-link), not the whole flake source (which would rebuild
|
||||
# every agent container). The `reference-docs` build from `../docs`
|
||||
# stays only for standalone `nix build .#reference-docs` from a
|
||||
# full checkout — the meta path never evaluates it.
|
||||
# Filtered view of this repo the swarm builder builds on as its `hyperhive`
|
||||
# input. Drops files no nix or cargo derivation reads — shell helper
|
||||
# scripts and root-level markdown. `docs/` is kept: the agent base's
|
||||
# `reference-docs` package builds from it.
|
||||
hyperhiveFlakeSource = lib.cleanSourceWith {
|
||||
name = "hyperhive-flake-source";
|
||||
src = ../.;
|
||||
|
|
@ -31,19 +18,6 @@
|
|||
rel = lib.removePrefix (toString ../. + "/") (toString path);
|
||||
in
|
||||
!(lib.hasPrefix "scripts/" rel || rel == "scripts")
|
||||
&& !(lib.hasPrefix "docs/" rel || rel == "docs")
|
||||
&& !(type == "regular" && !lib.hasInfix "/" rel && lib.hasSuffix ".md" rel);
|
||||
};
|
||||
|
||||
# The repo `docs/` tree as a standalone narrow source. Its store
|
||||
# path moves ONLY on doc edits, decoupled from `hyperhiveFlakeSource`.
|
||||
# hive-c0re threads this to the meta flake as the `hyperhive-docs`
|
||||
# input (same pattern as the `hyperhive` input); the harness resolves
|
||||
# `$HIVE_DOCS_DIR` from it via `services.hyperhive.agent.docs.source`. Evaluated
|
||||
# here on the host where docs/ exists — it cannot be derived from
|
||||
# inside the docs-stripped `hyperhiveFlakeSource`.
|
||||
hyperhiveDocsSource = lib.cleanSourceWith {
|
||||
name = "hyperhive-docs-source";
|
||||
src = ../docs;
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue