nix: move the agent option namespace under services.hyperhive.agent
Every per-agent harness option lived at the top-level `hyperhive.*` while the host tier has always been `services.hyperhive.*`. Move all 52 agent-tier option leaves (33 top-level names across 16 modules) to `services.hyperhive.agent.*`, repoint every read, and keep existing agent configs evaluating through one `mkRenamedOptionModule` per old leaf path in the new nix/agent-modules/renamed-options.nix. The shims are per leaf rather than per namespace: `user`, `mcp`, `otel`, `queue`, `docs`, `forge`, `frontend`, `github`, `gui`, `logs`, `matrix` and `cargo` are plain attrsets of declarations, not submodule-typed options, so a parent-path rename would not reach their children. Three read-only options (`frontend.mergedDist`, `queue.clientIdFile`, `queue.clientSecretFile`) deliberately get no shim — a rename contributes a definition, which a read-only option refuses; the exclusions are commented in place. Refs #4473
This commit is contained in:
parent
60393d0e32
commit
3662eda440
21 changed files with 531 additions and 290 deletions
|
|
@ -1,4 +1,4 @@
|
|||
# GitHub integration (hyperhive.github.enable): a `gh` wrapper + a git
|
||||
# GitHub integration (services.hyperhive.agent.github.enable): a `gh` wrapper + a git
|
||||
# credential helper, both reading the PAT from the agent's
|
||||
# `github-token` state file at invocation, so a dashboard-pasted token
|
||||
# takes effect with no rebuild. The token PATH is baked in at build
|
||||
|
|
@ -15,7 +15,7 @@
|
|||
...
|
||||
}:
|
||||
let
|
||||
userName = config.hyperhive.user.name;
|
||||
userName = config.services.hyperhive.agent.user.name;
|
||||
ghWrapper = pkgs.writeShellScriptBin "gh" ''
|
||||
if [ -r "/agents/${userName}/state/github-token" ]; then
|
||||
GH_TOKEN="$(cat "/agents/${userName}/state/github-token")"
|
||||
|
|
@ -35,7 +35,7 @@ let
|
|||
'';
|
||||
in
|
||||
{
|
||||
options.hyperhive.github.enable = lib.mkOption {
|
||||
options.services.hyperhive.agent.github.enable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = true;
|
||||
description = ''
|
||||
|
|
@ -63,7 +63,7 @@ in
|
|||
config = {
|
||||
# No bare pkgs.gh here — the wrapper *is* `gh` and hardcodes the
|
||||
# real binary path, so it can't be shadowed.
|
||||
environment.systemPackages = lib.optionals config.hyperhive.github.enable [
|
||||
environment.systemPackages = lib.optionals config.services.hyperhive.agent.github.enable [
|
||||
ghWrapper
|
||||
gitCredHelper
|
||||
];
|
||||
|
|
@ -78,7 +78,7 @@ in
|
|||
# entries in the harness modules) — a whole-set `environment.etc = {…}`
|
||||
# here would collide with them at the nix level ("attribute already
|
||||
# defined").
|
||||
environment.etc."gitconfig" = lib.mkIf config.hyperhive.github.enable {
|
||||
environment.etc."gitconfig" = lib.mkIf config.services.hyperhive.agent.github.enable {
|
||||
text = ''
|
||||
[credential "https://github.com"]
|
||||
helper = hive-github
|
||||
|
|
@ -100,7 +100,7 @@ in
|
|||
# extractor copies exactly one binary, so an agent that installs
|
||||
# only the Forgejo poller has no github.com poller anywhere in its
|
||||
# closure — not merely an unstarted unit.
|
||||
systemd.services.hive-github-notify = lib.mkIf config.hyperhive.github.enable {
|
||||
systemd.services.hive-github-notify = lib.mkIf config.services.hyperhive.agent.github.enable {
|
||||
description = "github.com notification poller for this agent";
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
after = [ "network.target" ];
|
||||
|
|
@ -113,7 +113,7 @@ in
|
|||
# poller reads the agent's `github-token` from under it.
|
||||
};
|
||||
serviceConfig = {
|
||||
ExecStart = "${config.hyperhive.packages.hive-github-notify}/bin/hive-github-notify";
|
||||
ExecStart = "${config.services.hyperhive.agent.packages.hive-github-notify}/bin/hive-github-notify";
|
||||
SyslogIdentifier = "hive-github-notify";
|
||||
# `on-failure`, NOT `always`, for the same reason as the forge
|
||||
# poller: this unit ships on every agent, but most agents have no
|
||||
|
|
|
|||
Loading…
Reference in a new issue