diff --git a/README.md b/README.md index 6be60866..cd092d34 100644 --- a/README.md +++ b/README.md @@ -429,7 +429,7 @@ services.hermes-webui = { The module defaults to `127.0.0.1`. Set `host = "0.0.0.0"` and `openFirewall = true` only when you want direct network access, and pair that with auth, for example `HERMES_WEBUI_PASSWORD` via `environmentFiles`. -You can also set `agent.package` instead of `agent.dir` when you are using a compatible Hermes Agent package layout. When the package exposes `passthru.hermesVenv`, the module derives `HERMES_WEBUI_AGENT_DIR` from that venv's site-packages path and sets `HERMES_WEBUI_PYTHON` from the same venv interpreter so bootstrap can use agent dependencies without creating a local `.venv`. If the package does not expose that venv metadata, set `agent.dir` and `agent.python` explicitly. +You can also set `agent.package` instead of `agent.dir` when you are using a compatible Hermes Agent package layout. When the package exposes `passthru.hermesAgentDir`, the module derives `HERMES_WEBUI_AGENT_DIR` from that path. When it exposes `passthru.hermesVenv`, the module derives `HERMES_WEBUI_PYTHON` from the venv interpreter so bootstrap can use agent dependencies without creating a local `.venv`. If the package does not expose either metadata path, set `agent.dir` and `agent.python` explicitly. When WebUI reads shared Hermes Agent state, run the service as a user that can already read that state. For a co-located Hermes Agent service, set `user` and `group` to the agent service account; the module only creates the default `hermes-webui` account and never changes ownership of an existing `hermesHome`. diff --git a/nix/nixosModules.nix b/nix/nixosModules.nix index a41309b8..932c251f 100644 --- a/nix/nixosModules.nix +++ b/nix/nixosModules.nix @@ -50,8 +50,8 @@ let inferredAgentDir = if cfg.agent.package == null then null - else if (cfg.agent.package ? passthru) && (cfg.agent.package.passthru ? hermesVenv) then - "${cfg.agent.package.passthru.hermesVenv}/lib/python3.12/site-packages" + else if (cfg.agent.package ? passthru) && (cfg.agent.package.passthru ? hermesAgentDir) then + "${cfg.agent.package.passthru.hermesAgentDir}" else null; @@ -148,7 +148,7 @@ in package = lib.mkOption { type = lib.types.nullOr lib.types.package; default = null; - description = "Package to derive HERMES_WEBUI_AGENT_DIR and HERMES_WEBUI_PYTHON from when it exposes passthru.hermesVenv."; + description = "Package to derive HERMES_WEBUI_AGENT_DIR from passthru.hermesAgentDir and HERMES_WEBUI_PYTHON from passthru.hermesVenv."; }; dir = lib.mkOption { diff --git a/tests/test_nix_flake_module_source.py b/tests/test_nix_flake_module_source.py index 397bf3ae..9ca216d5 100644 --- a/tests/test_nix_flake_module_source.py +++ b/tests/test_nix_flake_module_source.py @@ -32,9 +32,14 @@ def test_nixos_module_decouples_agent_dir_from_python_inference(): assert "cfg.agent.dir == null && configuredAgentPython" not in MODULE_NIX -def test_nixos_module_uses_agent_venv_site_packages_when_available(): - assert "${cfg.agent.package.passthru.hermesVenv}/lib/python3.12/site-packages" in MODULE_NIX - assert "${cfg.agent.package}/share/hermes-agent" not in MODULE_NIX +def test_nixos_module_uses_explicit_agent_dir_passthru_when_available(): + hardcoded_python_site_packages = "lib/" + "python3.12" + "/site-packages" + legacy_agent_share_dir = "${cfg.agent.package}" + "/share/" + "hermes-agent" + + assert "cfg.agent.package.passthru ? hermesAgentDir" in MODULE_NIX + assert "${cfg.agent.package.passthru.hermesAgentDir}" in MODULE_NIX + assert hardcoded_python_site_packages not in MODULE_NIX + assert legacy_agent_share_dir not in MODULE_NIX def test_nixos_module_does_not_chown_existing_hermes_home():