module-eval: evaluate shared fixture configs once
Thirty-three module-eval fixtures were a second (or later) full `nixosSystem` evaluation of a config another fixture already evaluated: 16 shapes defined identically in two to seven cluster files, plus duplicates inside agent-queue-bao, core-toggle and swarm-services-switch. Each cluster imports ./lib.nix itself, so nothing was shared between them. nix/module-eval/shared.nix now defines each of those 16 shapes once. nix/checks.nix instantiates it a single time and passes it as `shared` to the 23 clusters that read one, and each cluster rebinds the fixture under its existing local name. Assertions are unchanged. Case text changes only in core-toggle, where two cases built the forge-host fixture inline and now read the file's `forgeHere`, and in two inline `let` bindings (bao-otel-collector, grafana) that now take the shared fixture. Six folds are value-equal rather than textually equal: they drop an explicit `deploy.hive-controller.enable = false` or `deploy.swarm-otel.enable = false` that equals what the option already resolves to for that config. Nothing under nix/host-modules sets either option apart from the `mkDefault allSwarmServices` on swarm-otel, and the only option-priority read there is `domain.highestPrio`. Part of #5171.
This commit is contained in:
parent
53d0d59be0
commit
18ed3f5040
25 changed files with 201 additions and 147 deletions
|
|
@ -6,6 +6,7 @@
|
|||
lib,
|
||||
self,
|
||||
nixosSystem,
|
||||
shared,
|
||||
}:
|
||||
let
|
||||
inherit
|
||||
|
|
@ -27,9 +28,9 @@ let
|
|||
swarmServiceEnables
|
||||
;
|
||||
|
||||
allLocal = hiveWithController { deploy.singleHostSwarm = true; };
|
||||
inherit (shared) allLocal;
|
||||
|
||||
bare = hiveWithController { };
|
||||
bare = shared.bareWithController;
|
||||
|
||||
# The same stub with the central toggle (`deploy.hive-controller.enable`)
|
||||
# off. Paired with `bare` below to pin the defaults that do not read it:
|
||||
|
|
@ -41,7 +42,9 @@ let
|
|||
# nothing on" host the swarm-service absences below read: none of the
|
||||
# per-service deployment toggles derives from the hive being on, so it
|
||||
# renders the same absences `bare` does.
|
||||
centralToggleOff = hive { deploy.hive-controller.enable = false; };
|
||||
centralToggleOff = shared.bare;
|
||||
|
||||
inherit (shared) forgeHere;
|
||||
|
||||
# Every hive defaults the agents' queue address to the queue's name, so the
|
||||
# only hive without one is a hive told to have none.
|
||||
|
|
@ -123,12 +126,7 @@ let
|
|||
# (./forge-placement.nix), never the central toggle: a forge host with
|
||||
# the toggle off still publishes it.
|
||||
name = "the forge's controller-token publisher does not consult the central toggle";
|
||||
ok =
|
||||
(hive {
|
||||
deploy.hive-controller.enable = false;
|
||||
deploy.forgejo.enable = true;
|
||||
}).systemd.services
|
||||
? swarm-bao-forge-publisher;
|
||||
ok = forgeHere.systemd.services ? swarm-bao-forge-publisher;
|
||||
}
|
||||
{
|
||||
name = "a hive that does not host the swarm's shared services runs none of them";
|
||||
|
|
@ -233,7 +231,6 @@ let
|
|||
name = "a gateway's services leaf asks for only the swarm names that host fronts";
|
||||
ok =
|
||||
let
|
||||
forgeHere = hive { deploy.forgejo.enable = true; };
|
||||
s = forgeHere.services.hyperhive.swarm.serviceDomains;
|
||||
u = forgeHere.systemd.services.swarm-services-cert.script;
|
||||
in
|
||||
|
|
@ -251,11 +248,7 @@ let
|
|||
let
|
||||
s = h: h.services.hyperhive.swarm.serviceDomains;
|
||||
in
|
||||
s (hive {
|
||||
deploy.forgejo.enable = true;
|
||||
}) == s bare
|
||||
&& s allLocal == s bare
|
||||
&& lib.elem "grafana.t.local" (s bare);
|
||||
s forgeHere == s bare && s allLocal == s bare && lib.elem "grafana.t.local" (s bare);
|
||||
}
|
||||
{
|
||||
# The narrowing's floor: no names left means no request, rather than a
|
||||
|
|
|
|||
Loading…
Reference in a new issue