An agent's memory cap was rendered into its flake (`memoryMaxBytes` → `services.hyperhive.agent.claudeMemoryMaxBytes`), so the closure depended on it and a changed cap reached the JSC heap ceiling and the subagent `MemoryHigh=` only after a rebuild. hive-c0re now writes the effective `MemoryMax=` in bytes to the agent's runtime dir (`/run/hive/memory-max-bytes` inside) in `write_dropins`, from the same value the drop-in gets. The file is removed for `infinity` or a RAM percentage, and left alone when the drop-in is kept. Inside the container, `nix/agent-modules/memory-cap.nix` reads it at boot: an environment generator sets `BUN_JSC_forceRAMSize` (75%) for every unit and `machinectl shell`, `/etc/set-environment` exports it in login shells, and a unit generator writes `MemoryHigh=` (2/3) as a drop-in for `hive-subagent-daemon`. The render drops `memoryMaxBytes`, the agent option is removed (both spellings fail eval with a removal message), and `effective_memory_bytes_from` goes with its only caller. Part of #5081 (slice S0-2).
207 lines
7.8 KiB
Nix
207 lines
7.8 KiB
Nix
# Deprecation shims for the agent tier's top-level `hyperhive.*` spelling.
|
|
#
|
|
# Per-agent options live at `services.hyperhive.agent.<name>`, beside the host
|
|
# tier's `services.hyperhive.*`. These entries keep an `agent.nix` that still
|
|
# uses the top-level `hyperhive.<name>` spelling evaluating, with a
|
|
# deprecation warning.
|
|
#
|
|
# ⚠️ One entry per LEAF, not per namespace. A single entry for a parent path
|
|
# only covers its children when the parent is a submodule-typed option; every
|
|
# nested option here (`user`, `mcp`, `otel`, …) is a plain attrset of
|
|
# declarations instead, so each leaf needs its own line — the same reason
|
|
# `../host-modules/deploy.nix` renames the CI runner's knobs one by one.
|
|
{ lib, ... }:
|
|
{
|
|
imports = [
|
|
(lib.mkRenamedOptionModule
|
|
[ "hyperhive" "_bashEnvFragments" ]
|
|
[ "services" "hyperhive" "agent" "_bashEnvFragments" ]
|
|
)
|
|
(lib.mkRenamedOptionModule
|
|
[ "hyperhive" "allowedRecipients" ]
|
|
[ "services" "hyperhive" "agent" "allowedRecipients" ]
|
|
)
|
|
(lib.mkRenamedOptionModule
|
|
[ "hyperhive" "autoCompact" ]
|
|
[ "services" "hyperhive" "agent" "autoCompact" ]
|
|
)
|
|
(lib.mkRenamedOptionModule
|
|
[ "hyperhive" "availableModels" ]
|
|
[ "services" "hyperhive" "agent" "availableModels" ]
|
|
)
|
|
(lib.mkRenamedOptionModule
|
|
[ "hyperhive" "backendEnvironmentFile" ]
|
|
[ "services" "hyperhive" "agent" "backendEnvironmentFile" ]
|
|
)
|
|
(lib.mkRenamedOptionModule
|
|
[ "hyperhive" "cargo" "shortMessages" ]
|
|
[ "services" "hyperhive" "agent" "cargo" "shortMessages" ]
|
|
)
|
|
(lib.mkRenamedOptionModule
|
|
[ "hyperhive" "claudeCodePath" ]
|
|
[ "services" "hyperhive" "agent" "claudeCodePath" ]
|
|
)
|
|
(lib.mkRenamedOptionModule
|
|
[ "hyperhive" "claudeMarketplaces" ]
|
|
[ "services" "hyperhive" "agent" "claudeMarketplaces" ]
|
|
)
|
|
(lib.mkRenamedOptionModule
|
|
[ "hyperhive" "claudePlugins" ]
|
|
[ "services" "hyperhive" "agent" "claudePlugins" ]
|
|
)
|
|
(lib.mkRenamedOptionModule
|
|
[ "hyperhive" "claudePluginsAutoUpdate" ]
|
|
[ "services" "hyperhive" "agent" "claudePluginsAutoUpdate" ]
|
|
)
|
|
(lib.mkRenamedOptionModule
|
|
[ "hyperhive" "dashboardLinks" ]
|
|
[ "services" "hyperhive" "agent" "dashboardLinks" ]
|
|
)
|
|
(lib.mkRenamedOptionModule
|
|
[ "hyperhive" "docs" "enable" ]
|
|
[ "services" "hyperhive" "agent" "docs" "enable" ]
|
|
)
|
|
(lib.mkRenamedOptionModule
|
|
[ "hyperhive" "docs" "source" ]
|
|
[ "services" "hyperhive" "agent" "docs" "source" ]
|
|
)
|
|
(lib.mkRenamedOptionModule
|
|
[ "hyperhive" "effortLevel" ]
|
|
[ "services" "hyperhive" "agent" "effortLevel" ]
|
|
)
|
|
(lib.mkRenamedOptionModule
|
|
[ "hyperhive" "extraMcpServers" ]
|
|
[ "services" "hyperhive" "agent" "extraMcpServers" ]
|
|
)
|
|
(lib.mkRenamedOptionModule
|
|
[ "hyperhive" "extraWebProxies" ]
|
|
[ "services" "hyperhive" "agent" "extraWebProxies" ]
|
|
)
|
|
(lib.mkRenamedOptionModule
|
|
[ "hyperhive" "forge" "url" ]
|
|
[ "services" "hyperhive" "agent" "forge" "url" ]
|
|
)
|
|
(lib.mkRenamedOptionModule
|
|
[ "hyperhive" "frontend" "dist" ]
|
|
[ "services" "hyperhive" "agent" "frontend" "dist" ]
|
|
)
|
|
(lib.mkRenamedOptionModule
|
|
[ "hyperhive" "frontend" "extraFiles" ]
|
|
[ "services" "hyperhive" "agent" "frontend" "extraFiles" ]
|
|
)
|
|
# `frontend.mergedDist` deliberately has NO entry:
|
|
# it is `readOnly` and ./frontend.nix already defines it, and a rename
|
|
# module contributes a *definition* to its target — so a shim for it makes
|
|
# every evaluation fail with "set multiple times". Nothing could have set
|
|
# it anyway; a reader of the old path gets "option does not exist",
|
|
# which says the same thing sooner. Same reasoning as the `hostUsersFile`
|
|
# exclusion in ../host-modules/deploy.nix.
|
|
(lib.mkRenamedOptionModule
|
|
[ "hyperhive" "github" "enable" ]
|
|
[ "services" "hyperhive" "agent" "github" "enable" ]
|
|
)
|
|
(lib.mkRenamedOptionModule
|
|
[ "hyperhive" "gui" "enable" ]
|
|
[ "services" "hyperhive" "agent" "gui" "enable" ]
|
|
)
|
|
(lib.mkRenamedOptionModule
|
|
[ "hyperhive" "gui" "vncPort" ]
|
|
[ "services" "hyperhive" "agent" "gui" "vncPort" ]
|
|
)
|
|
(lib.mkRenamedOptionModule [ "hyperhive" "icon" ] [ "services" "hyperhive" "agent" "icon" ])
|
|
(lib.mkRenamedOptionModule
|
|
[ "hyperhive" "logs" "queryUrl" ]
|
|
[ "services" "hyperhive" "agent" "logs" "queryUrl" ]
|
|
)
|
|
# `matrix.enable` is deliberately absent from this list: it has no
|
|
# replacement option, and a rename pointing at an undeclared option
|
|
# breaks evaluation for everyone. Both of its spellings are
|
|
# `mkRemovedOptionModule` in ./default.nix instead.
|
|
(lib.mkRenamedOptionModule
|
|
[ "hyperhive" "matrix" "url" ]
|
|
[ "services" "hyperhive" "agent" "matrix" "url" ]
|
|
)
|
|
(lib.mkRenamedOptionModule
|
|
[ "hyperhive" "matrixAccounts" ]
|
|
[ "services" "hyperhive" "agent" "matrixAccounts" ]
|
|
)
|
|
(lib.mkRenamedOptionModule
|
|
[ "hyperhive" "mcp" "bashHttpPort" ]
|
|
[ "services" "hyperhive" "agent" "mcp" "bashHttpPort" ]
|
|
)
|
|
(lib.mkRenamedOptionModule
|
|
[ "hyperhive" "mcp" "httpPort" ]
|
|
[ "services" "hyperhive" "agent" "mcp" "httpPort" ]
|
|
)
|
|
(lib.mkRenamedOptionModule
|
|
[ "hyperhive" "mcp" "matrixHttpPort" ]
|
|
[ "services" "hyperhive" "agent" "mcp" "matrixHttpPort" ]
|
|
)
|
|
(lib.mkRenamedOptionModule
|
|
[ "hyperhive" "mcp" "subagentHttpPort" ]
|
|
[ "services" "hyperhive" "agent" "mcp" "subagentHttpPort" ]
|
|
)
|
|
(lib.mkRenamedOptionModule [ "hyperhive" "model" ] [ "services" "hyperhive" "agent" "model" ])
|
|
(lib.mkRenamedOptionModule
|
|
[ "hyperhive" "otel" "debug" ]
|
|
[ "services" "hyperhive" "agent" "otel" "debug" ]
|
|
)
|
|
(lib.mkRenamedOptionModule
|
|
[ "hyperhive" "otel" "enable" ]
|
|
[ "services" "hyperhive" "agent" "otel" "enable" ]
|
|
)
|
|
(lib.mkRenamedOptionModule
|
|
[ "hyperhive" "otel" "endpoint" ]
|
|
[ "services" "hyperhive" "agent" "otel" "endpoint" ]
|
|
)
|
|
(lib.mkRenamedOptionModule
|
|
[ "hyperhive" "otel" "extraResourceAttributes" ]
|
|
[ "services" "hyperhive" "agent" "otel" "extraResourceAttributes" ]
|
|
)
|
|
(lib.mkRenamedOptionModule
|
|
[ "hyperhive" "otel" "metricIntervalMs" ]
|
|
[ "services" "hyperhive" "agent" "otel" "metricIntervalMs" ]
|
|
)
|
|
(lib.mkRenamedOptionModule
|
|
[ "hyperhive" "otel" "protocol" ]
|
|
[ "services" "hyperhive" "agent" "otel" "protocol" ]
|
|
)
|
|
(lib.mkRenamedOptionModule [ "hyperhive" "packages" ] [ "services" "hyperhive" "agent" "packages" ])
|
|
(lib.mkRenamedOptionModule
|
|
[ "hyperhive" "queue" "natsUrl" ]
|
|
[ "services" "hyperhive" "agent" "queue" "natsUrl" ]
|
|
)
|
|
(lib.mkRenamedOptionModule
|
|
[ "hyperhive" "queue" "tokenEndpoint" ]
|
|
[ "services" "hyperhive" "agent" "queue" "tokenEndpoint" ]
|
|
)
|
|
# `queue.clientIdFile` / `queue.clientSecretFile` are excluded for the
|
|
# `mergedDist` reason above: both are `readOnly`, so a shim's definition
|
|
# collides with the option's own and breaks every evaluation. They are
|
|
# derived paths no agent config could have set.
|
|
(lib.mkRenamedOptionModule
|
|
[ "hyperhive" "swarmName" ]
|
|
[ "services" "hyperhive" "agent" "swarmName" ]
|
|
)
|
|
(lib.mkRenamedOptionModule
|
|
[ "hyperhive" "useApiKey" ]
|
|
[ "services" "hyperhive" "agent" "useApiKey" ]
|
|
)
|
|
(lib.mkRenamedOptionModule
|
|
[ "hyperhive" "user" "gid" ]
|
|
[ "services" "hyperhive" "agent" "user" "gid" ]
|
|
)
|
|
(lib.mkRenamedOptionModule
|
|
[ "hyperhive" "user" "name" ]
|
|
[ "services" "hyperhive" "agent" "user" "name" ]
|
|
)
|
|
(lib.mkRenamedOptionModule
|
|
[ "hyperhive" "user" "passwordlessSudo" ]
|
|
[ "services" "hyperhive" "agent" "user" "passwordlessSudo" ]
|
|
)
|
|
(lib.mkRenamedOptionModule
|
|
[ "hyperhive" "user" "uid" ]
|
|
[ "services" "hyperhive" "agent" "user" "uid" ]
|
|
)
|
|
];
|
|
}
|