move c0re.hyperhiveFlake to deploy.hyperhiveFlake
This commit is contained in:
parent
76de27fc97
commit
70538fb209
6 changed files with 39 additions and 24 deletions
|
|
@ -198,6 +198,11 @@ in
|
|||
|
||||
# The c0re daemon is the hive-controller service, so its knobs and package
|
||||
# options sit under it. Same types, same meanings.
|
||||
# One host-level value, read by hive-c0re and the swarm builder alike.
|
||||
(lib.mkRenamedOptionModule
|
||||
[ "services" "hyperhive" "c0re" "hyperhiveFlake" ]
|
||||
[ "services" "hyperhive" "deploy" "hyperhiveFlake" ]
|
||||
)
|
||||
(lib.mkRenamedOptionModule
|
||||
[ "services" "hyperhive" "c0re" "package" ]
|
||||
[ "services" "hyperhive" "deploy" "hive-controller" "package" ]
|
||||
|
|
|
|||
|
|
@ -11,8 +11,8 @@
|
|||
...
|
||||
}:
|
||||
let
|
||||
cfg = config.services.hyperhive.c0re;
|
||||
controllerCfg = config.services.hyperhive.deploy.hive-controller;
|
||||
hyperhiveFlake = config.services.hyperhive.deploy.hyperhiveFlake;
|
||||
|
||||
# `/run/hyperhive`'s mode. Held in one place because whichever of the two
|
||||
# units below activates first creates the directory, so they cannot be
|
||||
|
|
@ -81,7 +81,7 @@ let
|
|||
# NOT trigger a startup sweep that rebuilds every agent — unless the
|
||||
# c0re binary itself changes.
|
||||
serveConfigJson = builtins.toJSON {
|
||||
hyperhive_flake = cfg.hyperhiveFlake;
|
||||
hyperhive_flake = hyperhiveFlake;
|
||||
|
||||
# The `claude-code` every agent runs, or null for "each agent keeps
|
||||
# the one out of its own nixpkgs". `builtins.toJSON` serialises a
|
||||
|
|
|
|||
|
|
@ -1,10 +1,9 @@
|
|||
# Option declarations for the c0re daemon. `services.hyperhive.c0re.*`
|
||||
# keeps the flake-source option the swarm builder also reads
|
||||
# (`hyperhiveFlake`); every other knob and the
|
||||
# Option declarations for the c0re daemon. The knobs and the
|
||||
# package/asset options the flake's `nixosModules.default` wires to its
|
||||
# own outputs (they carry no in-module defaults; see ../../../flake.nix)
|
||||
# live under `services.hyperhive.deploy.hive-controller`, alongside the
|
||||
# values the meta-flake render hands the hive's agents. The read-only
|
||||
# values the meta-flake render hands the hive's agents. The flake-source
|
||||
# option the swarm builder also reads is `services.hyperhive.deploy.hyperhiveFlake`. The read-only
|
||||
# `servedFrontend` option lives in ./theme.nix with the stylix wiring
|
||||
# that computes it.
|
||||
{
|
||||
|
|
@ -22,17 +21,18 @@
|
|||
'')
|
||||
];
|
||||
|
||||
options.services.hyperhive.c0re = {
|
||||
hyperhiveFlake = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
defaultText = lib.literalMD "the hyperhive flake's own filtered source store path";
|
||||
description = ''
|
||||
Store path of the hyperhive flake source (no fragment). hive-c0re
|
||||
reads it to tell which revision is running, and the swarm builder
|
||||
builds on it. Wired by `nixosModules.default` to this flake's own
|
||||
filtered source.
|
||||
'';
|
||||
};
|
||||
# One host-level value that both hive-c0re and the swarm builder read, so it
|
||||
# sits under neither service.
|
||||
options.services.hyperhive.deploy.hyperhiveFlake = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
internal = true;
|
||||
defaultText = lib.literalMD "the hyperhive flake's own filtered source store path";
|
||||
description = ''
|
||||
Store path of the hyperhive flake source (no fragment). hive-c0re
|
||||
reads it to tell which revision is running, and the swarm builder
|
||||
builds on it. Wired by `nixosModules.default` to this flake's own
|
||||
filtered source.
|
||||
'';
|
||||
};
|
||||
|
||||
# The hive-controller's deployment options.
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ let
|
|||
nix = config.nix.package;
|
||||
|
||||
# Strings, not paths: both are already store paths.
|
||||
hyperhiveFlake = hyperhiveCfg.c0re.hyperhiveFlake;
|
||||
hyperhiveFlake = hyperhiveCfg.deploy.hyperhiveFlake;
|
||||
nixpkgsFlake = hyperhiveCfg.deploy.builder.nixpkgsFlake;
|
||||
|
||||
# The assertion below keeps the two options together.
|
||||
|
|
|
|||
|
|
@ -252,7 +252,7 @@ let
|
|||
# the same hyperhive and nixpkgs base.
|
||||
name = "the builder builds on the hyperhive and nixpkgs this host was deployed with";
|
||||
ok =
|
||||
env.SWARM_BUILDER_HYPERHIVE_FLAKE == withBuilder.services.hyperhive.c0re.hyperhiveFlake
|
||||
env.SWARM_BUILDER_HYPERHIVE_FLAKE == withBuilder.services.hyperhive.deploy.hyperhiveFlake
|
||||
&& env.SWARM_BUILDER_NIXPKGS_FLAKE == withBuilder.services.hyperhive.deploy.builder.nixpkgsFlake
|
||||
&& lib.hasSuffix "-check-flake" env.SWARM_BUILDER_CHECK_FLAKE
|
||||
&& env.SWARM_BUILDER_SYSTEM == pkgs.stdenv.hostPlatform.system
|
||||
|
|
|
|||
|
|
@ -1441,6 +1441,7 @@ let
|
|||
c0re.agentIoWeight = null;
|
||||
c0re.buildSlots = 3;
|
||||
c0re.adminUsers = [ "alice" ];
|
||||
c0re.hyperhiveFlake = "/nix/store/legacy-flake";
|
||||
};
|
||||
c = old.services.hyperhive.deploy.hive-controller;
|
||||
warned =
|
||||
|
|
@ -1468,6 +1469,8 @@ let
|
|||
&& c.agentIoWeight == null
|
||||
&& c.buildSlots == 3
|
||||
&& c.adminUsers == [ "alice" ]
|
||||
&& old.services.hyperhive.deploy.hyperhiveFlake == "/nix/store/legacy-flake"
|
||||
&& serve.hyperhive_flake == "/nix/store/legacy-flake"
|
||||
&& lib.all (warned old) [
|
||||
"package"
|
||||
"frontend"
|
||||
|
|
@ -1483,27 +1486,34 @@ let
|
|||
"agentIoWeight"
|
||||
"buildSlots"
|
||||
"adminUsers"
|
||||
"hyperhiveFlake"
|
||||
]
|
||||
&& !(warned bare "package")
|
||||
&& !(warned bare "adminUsers")
|
||||
&& !(warned bare "hyperhiveFlake")
|
||||
&& serve.agent_memory_max == "8G"
|
||||
&& serve.agent_cpu_quota == "300%"
|
||||
&& serve.build_slots == 3
|
||||
&& old.users.groups.hive-admin.members == [ "alice" ];
|
||||
}
|
||||
{
|
||||
# What the moved options render with their defaults: the agent limits
|
||||
# What the moved options render with their defaults: the flake source, the agent limits
|
||||
# and build slots in serve.json, the sudoless-hivectl group's members,
|
||||
# and the model price table. The same values the options held at their
|
||||
# old paths.
|
||||
name = "the agent limits, build slots, admin group and price table render their defaults unchanged";
|
||||
name = "the flake source, agent limits, build slots, admin group and price table render their defaults unchanged";
|
||||
ok =
|
||||
let
|
||||
serve = builtins.fromJSON (
|
||||
builtins.unsafeDiscardStringContext allLocal.environment.etc."hyperhive/serve.json".text
|
||||
);
|
||||
in
|
||||
serve.agent_memory_max == "4G"
|
||||
serve.hyperhive_flake
|
||||
== builtins.unsafeDiscardStringContext "${(import ../sources.nix { inherit lib; })
|
||||
.hyperhiveFlakeSource
|
||||
}"
|
||||
&& allLocal.services.hyperhive.deploy.hyperhiveFlake == serve.hyperhive_flake
|
||||
&& serve.agent_memory_max == "4G"
|
||||
&& serve.agent_cpu_quota == "200%"
|
||||
&& serve.agent_cpu_weight == 80
|
||||
&& serve.agent_io_weight == 80
|
||||
|
|
|
|||
Loading…
Reference in a new issue