Watch
0
0
Fork
You've already forked hyperhive
0

ci-runner: warn when the host has no nix store gc

This commit is contained in:
atlas 2026-11-11 18:16:54 +01:00 • committed by mara
commit 493d2e6c37

View file

@ -24,6 +24,7 @@ let
;
})
hive
hiveWith
runGroup
selfScrapes
;
@ -56,7 +57,7 @@ let
# The runner alone: no hive, no forge, no store, its store identity placed
# by hand. `nix` is a label without a scheme.
ciAlone = hive {
ciAloneOpts = {
deploy.hive-controller.enable = false;
deploy.ci-runner.enable = true;
deploy.ci-runner.labels = [
@ -66,6 +67,13 @@ let
deploy.bao.ciRunnerClientCertFile = "/etc/pki/bao-ci-runner.pem";
deploy.bao.ciRunnerClientKeyFile = "/etc/pki/bao-ci-runner-key.pem";
};
ciAlone = hive ciAloneOpts;
# `ciAlone` with the host's store collection set, one way each.
ciGcTimer = hiveWith [ { nix.gc.automatic = true; } ] ciAloneOpts;
ciMinFree = hiveWith [ { nix.settings.min-free = 20 * 1024 * 1024 * 1024; } ] ciAloneOpts;
ciOffNoGc = hive { deploy.hive-controller.enable = false; };
ciGcWarned =
m: lib.any (lib.hasInfix "neither nix.gc.automatic nor nix.settings.min-free") m.warnings;
ciNoIdentity = hive {
deploy.hive-controller.enable = false;
deploy.ci-runner.enable = true;
@ -211,6 +219,17 @@ let
in
!(lib.any (n: lib.elem n (u.after ++ u.wants ++ u.requires)) storeUnits);
}
{
# The module only warns: the host's nix settings stay the host's. Each
# collector alone, and the runner being off, silence the warning.
name = "the CI runner warns when the host has neither nix.gc.automatic nor nix.settings.min-free";
ok =
ciGcWarned ciAlone
&& !(ciGcWarned ciGcTimer)
&& !(ciGcWarned ciMinFree)
&& !(ciGcWarned ciOffNoGc)
&& !ciAlone.nix.gc.automatic;
}
{
# Without the identity the token never arrives; the control is the
# placed pair above.