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
|
|
@ -8,9 +8,9 @@
|
|||
...
|
||||
}:
|
||||
{
|
||||
options.hyperhive.frontend.dist = lib.mkOption {
|
||||
options.services.hyperhive.agent.frontend.dist = lib.mkOption {
|
||||
type = lib.types.package;
|
||||
default = config.hyperhive.packages.frontend;
|
||||
default = config.services.hyperhive.agent.packages.frontend;
|
||||
defaultText = lib.literalMD "`hyperhive.packages.frontend` (the flake's frontend dist)";
|
||||
description = ''
|
||||
The shipped frontend dist (built by `nix/packages/frontend.nix`).
|
||||
|
|
@ -22,18 +22,18 @@
|
|||
'';
|
||||
};
|
||||
|
||||
options.hyperhive.frontend.mergedDist = lib.mkOption {
|
||||
options.services.hyperhive.agent.frontend.mergedDist = lib.mkOption {
|
||||
type = lib.types.package;
|
||||
readOnly = true;
|
||||
description = ''
|
||||
Computed: the merged static tree consumed by the harness via
|
||||
`HIVE_STATIC_DIR`. Composed at evaluation time by copying
|
||||
`hyperhive.frontend.dist`'s `agent/` subdir as the base, then
|
||||
`services.hyperhive.agent.frontend.dist`'s `agent/` subdir as the base, then
|
||||
layering each `extraFiles` entry on top. Read-only — do not set directly.
|
||||
'';
|
||||
};
|
||||
|
||||
options.hyperhive.frontend.extraFiles = lib.mkOption {
|
||||
options.services.hyperhive.agent.frontend.extraFiles = lib.mkOption {
|
||||
type = lib.types.attrsOf (
|
||||
lib.types.submodule (
|
||||
{ name, ... }:
|
||||
|
|
@ -100,7 +100,7 @@
|
|||
prior entry's target), the `mergedDist` build aborts with
|
||||
`refusing to overwrite existing path '<target>' in the
|
||||
default dist`. To override a default file, fork the dist via
|
||||
`hyperhive.frontend.dist` instead — `extraFiles` is for
|
||||
`services.hyperhive.agent.frontend.dist` instead — `extraFiles` is for
|
||||
pure additions.
|
||||
|
||||
`target` must be a relative path inside the static dir. An
|
||||
|
|
@ -112,7 +112,7 @@
|
|||
|
||||
config = {
|
||||
assertions = [
|
||||
# hyperhive.frontend.extraFiles[*].target is concatenated into
|
||||
# services.hyperhive.agent.frontend.extraFiles[*].target is concatenated into
|
||||
# $out during the mergedDist build. The option's strMatching
|
||||
# type already rejects leading `/`, leading `.`, and the
|
||||
# weirder characters; this assertion catches mid-path `..`
|
||||
|
|
@ -122,10 +122,10 @@
|
|||
# kind of mistake that's easy to make and hard to spot.
|
||||
{
|
||||
assertion = lib.all (entry: !(builtins.any (seg: seg == "..") (lib.splitString "/" entry.target))) (
|
||||
lib.attrValues config.hyperhive.frontend.extraFiles
|
||||
lib.attrValues config.services.hyperhive.agent.frontend.extraFiles
|
||||
);
|
||||
message = ''
|
||||
hyperhive.frontend.extraFiles: `target` must not contain
|
||||
services.hyperhive.agent.frontend.extraFiles: `target` must not contain
|
||||
`..` path segments.
|
||||
'';
|
||||
}
|
||||
|
|
@ -137,20 +137,22 @@
|
|||
# filename collision with the default dist surfaces as a build
|
||||
# failure rather than a silent override (operator gets a clear
|
||||
# nix error rather than a confusing 404 / silent dist swap).
|
||||
hyperhive.frontend.mergedDist = pkgs.runCommand "hyperhive-agent-frontend-merged" { } (
|
||||
''
|
||||
mkdir -p $out
|
||||
cp -r ${config.hyperhive.frontend.dist}/agent/. $out/
|
||||
chmod -R u+w $out
|
||||
''
|
||||
+ lib.concatMapStrings (entry: ''
|
||||
mkdir -p $(dirname $out/${entry.target})
|
||||
if [ -e $out/${entry.target} ]; then
|
||||
echo "hyperhive.frontend.extraFiles: refusing to overwrite existing path '${entry.target}' in the default dist" >&2
|
||||
exit 1
|
||||
fi
|
||||
cp -r ${entry.source} $out/${entry.target}
|
||||
'') (lib.attrValues config.hyperhive.frontend.extraFiles)
|
||||
);
|
||||
services.hyperhive.agent.frontend.mergedDist =
|
||||
pkgs.runCommand "hyperhive-agent-frontend-merged" { }
|
||||
(
|
||||
''
|
||||
mkdir -p $out
|
||||
cp -r ${config.services.hyperhive.agent.frontend.dist}/agent/. $out/
|
||||
chmod -R u+w $out
|
||||
''
|
||||
+ lib.concatMapStrings (entry: ''
|
||||
mkdir -p $(dirname $out/${entry.target})
|
||||
if [ -e $out/${entry.target} ]; then
|
||||
echo "services.hyperhive.agent.frontend.extraFiles: refusing to overwrite existing path '${entry.target}' in the default dist" >&2
|
||||
exit 1
|
||||
fi
|
||||
cp -r ${entry.source} $out/${entry.target}
|
||||
'') (lib.attrValues config.services.hyperhive.agent.frontend.extraFiles)
|
||||
);
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue