mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-18 04:41:56 +00:00
feat(nix): add extraDependencyGroups for sealed venv extras (#21817)
Expose the dependency-groups parameter from python.nix through
hermes-agent.nix and the NixOS module, allowing users to opt into
pyproject.toml optional extras (e.g. hindsight, voice, matrix) that
are resolved by uv inside the sealed venv.
Unlike extraPythonPackages (which appends to PYTHONPATH and requires
collision checking), extraDependencyGroups resolves the full dependency
graph in a single uv pass — no PYTHONPATH patching, no version
conflicts, no collision risk.
When to use which:
- extraDependencyGroups: enable a pyproject.toml optional extra
- extraPythonPackages: add an external Python plugin not in pyproject.toml
Usage:
services.hermes-agent.extraDependencyGroups = [ "hindsight" ];
Or via overlay:
pkgs.hermes-agent.override { extraDependencyGroups = [ "hindsight" ]; }
Refs: #8873, #9194
This commit is contained in:
parent
d992fd9aaf
commit
5606258855
4 changed files with 71 additions and 4 deletions
|
|
@ -645,6 +645,28 @@ services.hermes-agent.extraPythonPackages = [
|
|||
|
||||
The package's `site-packages` is added to PYTHONPATH in the hermes wrapper. `importlib.metadata` discovers the entry point at session start.
|
||||
|
||||
### Optional Dependency Groups (`extraDependencyGroups`)
|
||||
|
||||
For optional extras already declared in hermes-agent's `pyproject.toml` (e.g., memory providers like `hindsight` or `honcho`), use `extraDependencyGroups` to include them in the sealed venv at build time:
|
||||
|
||||
```nix
|
||||
services.hermes-agent = {
|
||||
extraDependencyGroups = [ "hindsight" ];
|
||||
settings.memory.provider = "hindsight";
|
||||
};
|
||||
```
|
||||
|
||||
This is resolved by uv alongside core dependencies in a single pass — no PYTHONPATH patching, no collision risk. Available groups match the `[project.optional-dependencies]` keys in `pyproject.toml` (e.g., `"hindsight"`, `"honcho"`, `"voice"`, `"matrix"`, `"mistral"`, `"bedrock"`).
|
||||
|
||||
**When to use which:**
|
||||
|
||||
| Need | Option |
|
||||
|------|--------|
|
||||
| Enable a pyproject.toml optional extra | `extraDependencyGroups` |
|
||||
| Add an external Python plugin not in pyproject.toml | `extraPythonPackages` |
|
||||
| Add a system binary (pandoc, jq, etc.) | `extraPackages` |
|
||||
| Add a directory-based plugin source tree | `extraPlugins` |
|
||||
|
||||
### Combining Both
|
||||
|
||||
A directory plugin with third-party Python dependencies needs both options:
|
||||
|
|
@ -666,7 +688,9 @@ External flakes can override the package directly:
|
|||
inputs.hermes-agent.url = "github:NousResearch/hermes-agent";
|
||||
outputs = { hermes-agent, nixpkgs, ... }: {
|
||||
nixpkgs.overlays = [ hermes-agent.overlays.default ];
|
||||
# Then: pkgs.hermes-agent.override { extraPythonPackages = [...]; }
|
||||
# Then:
|
||||
# pkgs.hermes-agent.override { extraPythonPackages = [...]; }
|
||||
# pkgs.hermes-agent.override { extraDependencyGroups = [ "hindsight" ]; }
|
||||
};
|
||||
}
|
||||
```
|
||||
|
|
@ -812,6 +836,7 @@ nix build .#checks.x86_64-linux.config-roundtrip # merge script preserves use
|
|||
| `extraPackages` | `listOf package` | `[]` | Extra packages available to the agent. Added to the hermes user's per-user profile so terminal commands, skills, and cron jobs all see them |
|
||||
| `extraPlugins` | `listOf package` | `[]` | Directory plugin packages to symlink into `$HERMES_HOME/plugins/`. Each must contain `plugin.yaml` |
|
||||
| `extraPythonPackages` | `listOf package` | `[]` | Python packages added to PYTHONPATH for entry-point plugin discovery. Build with `python312Packages` |
|
||||
| `extraDependencyGroups` | `listOf str` | `[]` | pyproject.toml optional extras to include in the sealed venv (e.g. `["hindsight"]`). Resolved by uv — no collisions |
|
||||
| `restart` | `str` | `"always"` | systemd `Restart=` policy |
|
||||
| `restartSec` | `int` | `5` | systemd `RestartSec=` value |
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue