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
|
|
@ -16,7 +16,7 @@
|
|||
# all contributions across modules into one file. Generic by
|
||||
# design so future hooks don't need to rename this file or
|
||||
# invent a parallel dispatcher.
|
||||
options.hyperhive._bashEnvFragments = lib.mkOption {
|
||||
options.services.hyperhive.agent._bashEnvFragments = lib.mkOption {
|
||||
type = lib.types.lines;
|
||||
default = "";
|
||||
internal = true;
|
||||
|
|
@ -27,11 +27,11 @@
|
|||
unset, and the interactive bashrc hook is omitted — zero cost
|
||||
when no feature is on. Internal — set indirectly via the
|
||||
per-feature options that own the gate (e.g.
|
||||
`hyperhive.cargo.shortMessages`).
|
||||
`services.hyperhive.agent.cargo.shortMessages`).
|
||||
'';
|
||||
};
|
||||
|
||||
options.hyperhive.cargo.shortMessages = lib.mkOption {
|
||||
options.services.hyperhive.agent.cargo.shortMessages = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = true;
|
||||
example = false;
|
||||
|
|
@ -45,7 +45,7 @@
|
|||
carry no signal beyond the warning/error summary.
|
||||
|
||||
Implementation: contributes a `cargo` shell function to
|
||||
`/etc/hyperhive/bash-env.sh` (see `hyperhive._bashEnvFragments`).
|
||||
`/etc/hyperhive/bash-env.sh` (see `services.hyperhive.agent._bashEnvFragments`).
|
||||
Loaded via `BASH_ENV` for non-interactive shells (`bash -c` —
|
||||
what the claude `Bash` tool runs) and sourced from
|
||||
`programs.bash.interactiveShellInit` for interactive shells.
|
||||
|
|
@ -70,7 +70,7 @@
|
|||
# back to the un-wrapped binary in PATH (the rust toolchain's cargo
|
||||
# — either from `environment.systemPackages` or from whatever
|
||||
# `nix develop` shell the agent's working in).
|
||||
hyperhive._bashEnvFragments = lib.mkIf config.hyperhive.cargo.shortMessages ''
|
||||
services.hyperhive.agent._bashEnvFragments = lib.mkIf config.services.hyperhive.agent.cargo.shortMessages ''
|
||||
# Auto-injects --message-format short on cargo compile
|
||||
# subcommands so per-crate progress lines don't flood
|
||||
# claude's context. Bypassed when the caller already passes
|
||||
|
|
@ -108,15 +108,17 @@
|
|||
# Wiring is gated on at least one fragment being active so a
|
||||
# fully feature-disabled agent has neither the file nor the
|
||||
# `BASH_ENV` / interactive sourcing — zero cost in that case.
|
||||
environment.etc."hyperhive/bash-env.sh" = lib.mkIf (config.hyperhive._bashEnvFragments != "") {
|
||||
text = config.hyperhive._bashEnvFragments;
|
||||
};
|
||||
environment.etc."hyperhive/bash-env.sh" =
|
||||
lib.mkIf (config.services.hyperhive.agent._bashEnvFragments != "")
|
||||
{
|
||||
text = config.services.hyperhive.agent._bashEnvFragments;
|
||||
};
|
||||
|
||||
# Non-interactive bash invocations (claude's `Bash` tool runs
|
||||
# `bash -c`) source $BASH_ENV at startup — drops every active
|
||||
# feature hook's snippet into scope without touching
|
||||
# `/etc/profile` (login-only).
|
||||
environment.variables = lib.mkIf (config.hyperhive._bashEnvFragments != "") {
|
||||
environment.variables = lib.mkIf (config.services.hyperhive.agent._bashEnvFragments != "") {
|
||||
BASH_ENV = "/etc/hyperhive/bash-env.sh";
|
||||
};
|
||||
|
||||
|
|
@ -125,10 +127,12 @@
|
|||
# hook surface as claude's non-interactive calls. Gated on at
|
||||
# least one fragment being active so we don't write a no-op
|
||||
# source line into `/etc/bashrc` on fully-feature-disabled agents.
|
||||
programs.bash.interactiveShellInit = lib.mkIf (config.hyperhive._bashEnvFragments != "") ''
|
||||
if [ -r /etc/hyperhive/bash-env.sh ]; then
|
||||
. /etc/hyperhive/bash-env.sh
|
||||
fi
|
||||
'';
|
||||
programs.bash.interactiveShellInit =
|
||||
lib.mkIf (config.services.hyperhive.agent._bashEnvFragments != "")
|
||||
''
|
||||
if [ -r /etc/hyperhive/bash-env.sh ]; then
|
||||
. /etc/hyperhive/bash-env.sh
|
||||
fi
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue