Watch
0
0
Fork
You've already forked hyperhive
0

swarm-builder: give the check flake the hive's docs source

The builder's hyperhive input is the docs-stripped flake source, so an
agent config with docs.enable = true failed to evaluate: docs.source
defaults to reference-docs, built from the missing docs/. Pass the host's
c0re.hyperhiveDocs as a hyperhive-docs input and set docs.source from it,
as the hive's meta flake does.

Fixes #5411
This commit is contained in:
atlas 2026-10-17 08:54:06 +02:00 • committed by mara
commit e9c471caeb
6 changed files with 80 additions and 10 deletions

View file

@ -49,6 +49,30 @@ let
svc = inner.systemd.services.swarm-builder;
env = svc.environment;
# 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.
builderCheck =
agentModule:
let
src = env.SWARM_BUILDER_HYPERHIVE_FLAKE;
hyperhive = (import "${src}/flake.nix").outputs (
self.inputs
// {
self = hyperhive // {
outPath = src;
inherit (self) inputs;
};
}
);
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;
cases = [
{
name = "the swarm builder's container exists only where its host enables it";
@ -113,9 +137,10 @@ let
{
# The check builds on the sources a hive on this host would render into
# its meta flake, so a green check means the same base.
name = "the builder builds on the hyperhive and nixpkgs this host's hives use";
name = "the builder builds on the hyperhive, docs and nixpkgs this host's hives use";
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"
@ -150,6 +175,18 @@ let
&& lib.elem "execution" reviewer
&& !(lib.elem "meta" reviewer);
}
{
# `docs.enable` reads `docs.source`, whose default builds from the
# `docs/` the `hyperhive` source has none of; an eval error there fails
# this whole group.
name = "the builder's check evaluates a config with the reference docs on";
ok =
lib.hasSuffix ".drv"
(builderCheck {
services.hyperhive.agent.user.name = "a1";
services.hyperhive.agent.docs.enable = true;
}).drvPath;
}
{
# The responder denies a client id it does not know, and a NATS denial
# arrives as a timeout.