docs: split swarm/deploy options into their own reference pages
services.hyperhive.swarm.* used to carry both swarm-wide facts (name, domain, hives, ca) and the 'does THIS host run it' toggles for every swarm service. deploy.nix already split those toggles out into their own services.hyperhive.deploy.* namespace; this is the docs-side follow-up now that swarm.* is genuinely swarm-wide-only. nix/docs/default.nix: host.md drops the swarm/deploy subtrees (builtins.removeAttrs on the already-picked host tree, not lib.recursiveUpdate -- that merges rather than deletes, which would have silently kept them on host.md); swarm.md and deploy.md are new markdown pages, each its own pickSubtrees root. nix/packages/default.nix exposes docs-swarm/docs-deploy as flake outputs alongside the existing docs-host/docs-agent. docs/gotchas.md's Nix options reference section and docs/swarm/README.md get pointers to the new split.
This commit is contained in:
parent
09fe94a8ca
commit
a05d686875
4 changed files with 103 additions and 19 deletions
|
|
@ -452,13 +452,20 @@ hyperhive subsystem `mkForce false` so heavy build inputs stay out of
|
||||||
the eval) and `agentEval` (evaluates `agent.nix` fresh for the
|
the eval) and `agentEval` (evaluates `agent.nix` fresh for the
|
||||||
per-agent options tree).
|
per-agent options tree).
|
||||||
|
|
||||||
Three output trees consumed by `flake.nix`, all **markdown**:
|
Five output trees consumed by `flake.nix`, all **markdown**:
|
||||||
|
|
||||||
- `docs-host` — operator-facing host module options
|
- `docs-host` — operator-facing host module options
|
||||||
(`services.hyperhive.*`)
|
(`services.hyperhive.*` minus the `swarm`/`deploy` subtrees below)
|
||||||
|
- `docs-swarm` — swarm-wide facts, identical on every host in the swarm
|
||||||
|
(`services.hyperhive.swarm.*`)
|
||||||
|
- `docs-deploy` — this host's own deployment decisions, necessarily
|
||||||
|
different per host (`services.hyperhive.deploy.*` — added by
|
||||||
|
`nix/host-modules/deploy.nix`, split out of `swarm.*` for exactly this
|
||||||
|
reason: see that file's own comment)
|
||||||
- `docs-agent` — per-agent harness options (`hyperhive.*`
|
- `docs-agent` — per-agent harness options (`hyperhive.*`
|
||||||
declared in `nix/agent-modules/`)
|
declared in `nix/agent-modules/`)
|
||||||
- `docs` — bundle of `index.md` + `host.md` + `agent.md`
|
- `docs` — bundle of `index.md` + `host.md` + `swarm.md` +
|
||||||
|
`deploy.md` + `agent.md`
|
||||||
|
|
||||||
Pipeline:
|
Pipeline:
|
||||||
|
|
||||||
|
|
@ -478,7 +485,11 @@ Host options live entirely under `services.hyperhive.*`. The
|
||||||
`pickSubtrees` filter is rooted at `["services" "hyperhive"]` so the
|
`pickSubtrees` filter is rooted at `["services" "hyperhive"]` so the
|
||||||
options tree picks up everything under that root — picking against
|
options tree picks up everything under that root — picking against
|
||||||
stray roots produces an empty tree and renders the host page as
|
stray roots produces an empty tree and renders the host page as
|
||||||
template chrome with no `<h2>` headers.
|
template chrome with no `<h2>` headers. `docs-host` then drops the
|
||||||
|
`swarm`/`deploy` subtrees from that picked tree (`removeAttrs`, not a
|
||||||
|
second `pickSubtrees` root — the one exclusion this file needs doesn't
|
||||||
|
earn a general-purpose helper) since `docs-swarm`/`docs-deploy` each
|
||||||
|
pick their own root instead.
|
||||||
|
|
||||||
#### Docs drv stability: `nixSrc`
|
#### Docs drv stability: `nixSrc`
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,13 @@ coordinate across one or more hives. A single hyperhive instance
|
||||||
running on one host is already a swarm (one hive). This doc covers
|
running on one host is already a swarm (one hive). This doc covers
|
||||||
the additional config needed when the swarm spans multiple hosts.
|
the additional config needed when the swarm spans multiple hosts.
|
||||||
|
|
||||||
|
For the full option reference rather than prose: `services.hyperhive.swarm.*`
|
||||||
|
(swarm-wide facts, identical on every host) and `services.hyperhive.deploy.*`
|
||||||
|
(this host's own deployment decisions — does *this* machine run grafana,
|
||||||
|
the swarm controller, authelia, …) are separate generated pages, `nix
|
||||||
|
build .#docs-swarm` / `.#docs-deploy` or the website's `/options/swarm.html`
|
||||||
|
/ `/options/deploy.html`.
|
||||||
|
|
||||||
## Terminology
|
## Terminology
|
||||||
|
|
||||||
- **hive** — a single hyperhive installation on one host. Has its
|
- **hive** — a single hyperhive installation on one host. Has its
|
||||||
|
|
|
||||||
|
|
@ -5,11 +5,21 @@
|
||||||
nixosSystem,
|
nixosSystem,
|
||||||
}:
|
}:
|
||||||
# Nix options reference: `pkgs.nixosOptionsDoc` over two evaluated
|
# Nix options reference: `pkgs.nixosOptionsDoc` over two evaluated
|
||||||
# module trees, emitted as CommonMark (`host.md` + `agent.md`). The
|
# module trees, emitted as CommonMark (`host.md` + `agent.md` +
|
||||||
# HTML + CSS for `/options/` is rendered downstream by the website
|
# `swarm.md` + `deploy.md`). The HTML + CSS for `/options/` is rendered
|
||||||
# repo, which owns the presentation and shares one stylesheet with the
|
# downstream by the website repo, which owns the presentation and
|
||||||
# prose `/docs/` tree. Full pipeline + subtree-pick / output-tree
|
# shares one stylesheet with the prose `/docs/` tree. Full pipeline +
|
||||||
# rationale: docs/gotchas.md::Nix options reference.
|
# subtree-pick / output-tree rationale: docs/gotchas.md::Nix options
|
||||||
|
# reference.
|
||||||
|
#
|
||||||
|
# `swarm.md`/`deploy.md` split off `host.md` (mara: "move swarm options
|
||||||
|
# to new docs page... deploy.* is also one of the things that should be
|
||||||
|
# a sub page"): `services.hyperhive.swarm.*` was mixed — swarm-wide
|
||||||
|
# facts (name, domain, hives, ca) alongside "does THIS host run it"
|
||||||
|
# toggles — until `deploy.nix` moved every such toggle to its own flat
|
||||||
|
# `services.hyperhive.deploy.*` namespace. That reorg landed first
|
||||||
|
# (see deploy.nix's file-top comment); this is the docs-side follow-up
|
||||||
|
# now that `swarm.*` genuinely is swarm-wide-only.
|
||||||
let
|
let
|
||||||
# Content-addressed narrow source covering only the nix/ directory.
|
# Content-addressed narrow source covering only the nix/ directory.
|
||||||
# `builtins.unsafeDiscardStringContext` strips `self`'s store-path
|
# `builtins.unsafeDiscardStringContext` strips `self`'s store-path
|
||||||
|
|
@ -105,13 +115,44 @@ let
|
||||||
in
|
in
|
||||||
lib.foldl' lib.recursiveUpdate { } (map pick roots);
|
lib.foldl' lib.recursiveUpdate { } (map pick roots);
|
||||||
|
|
||||||
hostOptions = pickSubtrees hostEval.options [
|
hostOptionsFull = pickSubtrees hostEval.options [
|
||||||
[
|
[
|
||||||
"services"
|
"services"
|
||||||
"hyperhive"
|
"hyperhive"
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
|
|
||||||
|
# `swarm.*` and `deploy.*` get their own pages below — drop them from
|
||||||
|
# the host tree rather than duplicating them here too. `pickSubtrees`
|
||||||
|
# only ever picked `services.hyperhive` for `hostOptionsFull` (nothing
|
||||||
|
# else lives under `services` in this tree), so a direct replacement
|
||||||
|
# is correct here — NOT `lib.recursiveUpdate`, which merges rather
|
||||||
|
# than deletes: a key present on the left and absent on the right
|
||||||
|
# survives the "update," which would silently keep `swarm`/`deploy`
|
||||||
|
# on `host.md` instead of dropping them.
|
||||||
|
hostOptions = {
|
||||||
|
services.hyperhive = builtins.removeAttrs hostOptionsFull.services.hyperhive [
|
||||||
|
"swarm"
|
||||||
|
"deploy"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
swarmOptions = pickSubtrees hostEval.options [
|
||||||
|
[
|
||||||
|
"services"
|
||||||
|
"hyperhive"
|
||||||
|
"swarm"
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
|
deployOptions = pickSubtrees hostEval.options [
|
||||||
|
[
|
||||||
|
"services"
|
||||||
|
"hyperhive"
|
||||||
|
"deploy"
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
agentOptions = pickSubtrees agentEval.options [
|
agentOptions = pickSubtrees agentEval.options [
|
||||||
[ "hyperhive" ]
|
[ "hyperhive" ]
|
||||||
];
|
];
|
||||||
|
|
@ -121,6 +162,16 @@ let
|
||||||
inherit transformOptions;
|
inherit transformOptions;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
swarmDoc = pkgs.nixosOptionsDoc {
|
||||||
|
options = swarmOptions;
|
||||||
|
inherit transformOptions;
|
||||||
|
};
|
||||||
|
|
||||||
|
deployDoc = pkgs.nixosOptionsDoc {
|
||||||
|
options = deployOptions;
|
||||||
|
inherit transformOptions;
|
||||||
|
};
|
||||||
|
|
||||||
agentDoc = pkgs.nixosOptionsDoc {
|
agentDoc = pkgs.nixosOptionsDoc {
|
||||||
options = agentOptions;
|
options = agentOptions;
|
||||||
inherit transformOptions;
|
inherit transformOptions;
|
||||||
|
|
@ -144,32 +195,43 @@ let
|
||||||
} > $out
|
} > $out
|
||||||
'';
|
'';
|
||||||
|
|
||||||
# Bundle landing page — a short markdown index pointing at the two
|
# Bundle landing page — a short markdown index pointing at the four
|
||||||
# reference pages.
|
# reference pages.
|
||||||
indexMD = pkgs.writeText "hyperhive-options-index.md" ''
|
indexMD = pkgs.writeText "hyperhive-options-index.md" ''
|
||||||
# hyperhive — nix options reference
|
# hyperhive — nix options reference
|
||||||
|
|
||||||
Auto-generated from the hyperhive flake. Two reading paths:
|
Auto-generated from the hyperhive flake. Four reading paths:
|
||||||
|
|
||||||
- [host options](host.md) — options exposed by
|
- [host options](host.md) — options exposed by
|
||||||
`hyperhive.nixosModules.default` to operator host configurations
|
`hyperhive.nixosModules.default` to operator host configurations
|
||||||
(`services.hyperhive.{enable,domain,c0re,gateway}.*`,
|
(`services.hyperhive.{enable,domain,c0re,gateway,tls,network}.*`).
|
||||||
`services.hyperhive.swarm.{forge,matrix}.*`).
|
- [swarm options](swarm.md) — swarm-wide facts, identical on every
|
||||||
|
host in the swarm (`services.hyperhive.swarm.{name,domain,hives,
|
||||||
|
ca,forge,matrix}.*`).
|
||||||
|
- [deploy options](deploy.md) — this host's own deployment
|
||||||
|
decisions, necessarily different per host
|
||||||
|
(`services.hyperhive.deploy.*` — does *this* machine run
|
||||||
|
grafana, the swarm controller, authelia, …).
|
||||||
- [per-agent options](agent.md) — options declared in
|
- [per-agent options](agent.md) — options declared in
|
||||||
`nix/agent-modules/`, visible from every `agent.nix`
|
`nix/agent-modules/`, visible from every `agent.nix`
|
||||||
(`hyperhive.model`, `hyperhive.allowedRecipients`,
|
(`hyperhive.model`, `hyperhive.allowedRecipients`,
|
||||||
`hyperhive.extraMcpServers`, `hyperhive.frontend.*`,
|
`hyperhive.extraMcpServers`, `hyperhive.frontend.*`,
|
||||||
`hyperhive.forge.*`, `hyperhive.matrix.*`, `hyperhive.gui.*`).
|
`hyperhive.forge.*`, `hyperhive.matrix.*`, `hyperhive.gui.*`).
|
||||||
|
|
||||||
Regenerate with `nix build .#docs` (bundle), `.#docs-host`, or
|
Regenerate with `nix build .#docs` (bundle), `.#docs-host`,
|
||||||
`.#docs-agent`. Consumed by the website repo to render `/options/`.
|
`.#docs-swarm`, `.#docs-deploy`, or `.#docs-agent`. Consumed by the
|
||||||
|
website repo to render `/options/`.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
hostMD = mkMarkdownPage "docs-host" "hyperhive — host options" hostDoc;
|
hostMD = mkMarkdownPage "docs-host" "hyperhive — host options" hostDoc;
|
||||||
|
swarmMD = mkMarkdownPage "docs-swarm" "hyperhive — swarm options" swarmDoc;
|
||||||
|
deployMD = mkMarkdownPage "docs-deploy" "hyperhive — deploy options" deployDoc;
|
||||||
agentMD = mkMarkdownPage "docs-agent" "hyperhive — per-agent options" agentDoc;
|
agentMD = mkMarkdownPage "docs-agent" "hyperhive — per-agent options" agentDoc;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
host = hostMD;
|
host = hostMD;
|
||||||
|
swarm = swarmMD;
|
||||||
|
deploy = deployMD;
|
||||||
agent = agentMD;
|
agent = agentMD;
|
||||||
|
|
||||||
# Bundle of the option reference as markdown. The website renders
|
# Bundle of the option reference as markdown. The website renders
|
||||||
|
|
@ -179,6 +241,8 @@ in
|
||||||
mkdir -p $out
|
mkdir -p $out
|
||||||
cp ${indexMD} $out/index.md
|
cp ${indexMD} $out/index.md
|
||||||
cp ${hostMD} $out/host.md
|
cp ${hostMD} $out/host.md
|
||||||
|
cp ${swarmMD} $out/swarm.md
|
||||||
|
cp ${deployMD} $out/deploy.md
|
||||||
cp ${agentMD} $out/agent.md
|
cp ${agentMD} $out/agent.md
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -259,11 +259,13 @@ in
|
||||||
ruth-toplevel = self.nixosConfigurations.ruth.config.system.build.toplevel;
|
ruth-toplevel = self.nixosConfigurations.ruth.config.system.build.toplevel;
|
||||||
|
|
||||||
# Auto-generated nix options reference for hyperhive.
|
# Auto-generated nix options reference for hyperhive.
|
||||||
# `docs` bundles host + agent pages into one tree; the split
|
# `docs` bundles host + swarm + deploy + agent pages into one tree;
|
||||||
# outputs are useful when consumers only want one surface.
|
# the split outputs are useful when consumers only want one surface.
|
||||||
# All three are pure markdown — no rust or frontend deps in
|
# All five are pure markdown — no rust or frontend deps in
|
||||||
# the closure, so `nix build .#docs` is cheap.
|
# the closure, so `nix build .#docs` is cheap.
|
||||||
docs = docsAttrs.bundle;
|
docs = docsAttrs.bundle;
|
||||||
docs-host = docsAttrs.host;
|
docs-host = docsAttrs.host;
|
||||||
|
docs-swarm = docsAttrs.swarm;
|
||||||
|
docs-deploy = docsAttrs.deploy;
|
||||||
docs-agent = docsAttrs.agent;
|
docs-agent = docsAttrs.agent;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue