Watch
0
0
Fork
You've already forked hyperhive
0

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:
atlas 2026-10-13 00:55:01 +02:00 • committed by mara
commit 18ed3f5040
25 changed files with 201 additions and 147 deletions

View file

@ -12,6 +12,13 @@
}:
let
inherit (rust) cleanSrc cargoArtifacts nativeBuildInputs;
# Bound here, once, so every cluster handed it reads the same evaluation of
# each fixture; see ./module-eval/shared.nix.
moduleEvalShared = import ./module-eval/shared.nix {
inherit pkgs self nixosSystem;
inherit (pkgs) lib;
};
in
{
formatting = treefmt-eval.config.build.check self;
@ -30,14 +37,17 @@ in
module-eval-core-toggle = import ./module-eval/core-toggle.nix {
inherit pkgs self nixosSystem;
inherit (pkgs) lib;
shared = moduleEvalShared;
};
module-eval-swarm-services-switch = import ./module-eval/swarm-services-switch.nix {
inherit pkgs self nixosSystem;
inherit (pkgs) lib;
shared = moduleEvalShared;
};
module-eval-nats-authelia = import ./module-eval/nats-authelia.nix {
inherit pkgs self nixosSystem;
inherit (pkgs) lib;
shared = moduleEvalShared;
};
# Executes the queue server's config render, which `module-eval-nats-authelia`
# only sees as a store path: the callout xkey it writes is a build output.
@ -48,58 +58,72 @@ in
module-eval-nats-tls = import ./module-eval/nats-tls.nix {
inherit pkgs self nixosSystem;
inherit (pkgs) lib;
shared = moduleEvalShared;
};
module-eval-hive-tls = import ./module-eval/hive-tls.nix {
inherit pkgs self nixosSystem;
inherit (pkgs) lib;
shared = moduleEvalShared;
};
module-eval-matrix-core = import ./module-eval/matrix-core.nix {
inherit pkgs self nixosSystem;
inherit (pkgs) lib;
shared = moduleEvalShared;
};
module-eval-grafana = import ./module-eval/grafana.nix {
inherit pkgs self nixosSystem;
inherit (pkgs) lib;
shared = moduleEvalShared;
};
module-eval-forge-placement = import ./module-eval/forge-placement.nix {
inherit pkgs self nixosSystem;
inherit (pkgs) lib;
shared = moduleEvalShared;
};
module-eval-bao-basics = import ./module-eval/bao-basics.nix {
inherit pkgs self nixosSystem;
inherit (pkgs) lib;
shared = moduleEvalShared;
};
module-eval-bao-matrix-reader = import ./module-eval/bao-matrix-reader.nix {
inherit pkgs self nixosSystem;
inherit (pkgs) lib;
shared = moduleEvalShared;
};
module-eval-bao-grants = import ./module-eval/bao-grants.nix {
inherit pkgs self nixosSystem;
inherit (pkgs) lib;
shared = moduleEvalShared;
};
module-eval-bao-controller = import ./module-eval/bao-controller.nix {
inherit pkgs self nixosSystem;
inherit (pkgs) lib;
shared = moduleEvalShared;
};
module-eval-secret-publisher = import ./module-eval/secret-publisher.nix {
inherit pkgs self nixosSystem;
inherit (pkgs) lib;
shared = moduleEvalShared;
};
module-eval-bao-otel-collector = import ./module-eval/bao-otel-collector.nix {
inherit pkgs self nixosSystem;
inherit (pkgs) lib;
shared = moduleEvalShared;
};
module-eval-swarm-otel-core = import ./module-eval/swarm-otel-core.nix {
inherit pkgs self nixosSystem;
inherit (pkgs) lib;
shared = moduleEvalShared;
};
module-eval-swarm-otel-identity = import ./module-eval/swarm-otel-identity.nix {
inherit pkgs self nixosSystem;
inherit (pkgs) lib;
shared = moduleEvalShared;
};
module-eval-hive-otel = import ./module-eval/hive-otel.nix {
inherit pkgs self nixosSystem;
inherit (pkgs) lib;
shared = moduleEvalShared;
};
module-eval-name-guards = import ./module-eval/name-guards.nix {
inherit pkgs self nixosSystem;
@ -108,6 +132,7 @@ in
module-eval-agent-otel = import ./module-eval/agent-otel.nix {
inherit pkgs self nixosSystem;
inherit (pkgs) lib;
shared = moduleEvalShared;
};
# Not a subsystem cluster like its siblings but a single shared file, and
# its own derivation for that reason: both journald receivers import one
@ -121,6 +146,7 @@ in
module-eval-agent-queue-bao = import ./module-eval/agent-queue-bao.nix {
inherit pkgs self nixosSystem;
inherit (pkgs) lib;
shared = moduleEvalShared;
};
module-eval-agent-forge-bao = import ./module-eval/agent-forge-bao.nix {
inherit pkgs self nixosSystem;
@ -147,14 +173,17 @@ in
module-eval-agent-github-bao = import ./module-eval/agent-github-bao.nix {
inherit pkgs self nixosSystem;
inherit (pkgs) lib;
shared = moduleEvalShared;
};
module-eval-agent-memory = import ./module-eval/agent-memory.nix {
inherit pkgs self nixosSystem;
inherit (pkgs) lib;
shared = moduleEvalShared;
};
module-eval-agent-plugins = import ./module-eval/agent-plugins.nix {
inherit pkgs self nixosSystem;
inherit (pkgs) lib;
shared = moduleEvalShared;
};
module-eval-agent-runtime = import ./module-eval/agent-runtime.nix {
inherit pkgs self nixosSystem;
@ -171,6 +200,7 @@ in
module-eval-agent-matrix = import ./module-eval/agent-matrix.nix {
inherit pkgs self nixosSystem;
inherit (pkgs) lib;
shared = moduleEvalShared;
};
# Clippy via crane's first-class `cargoClippy` builder. Reuses the