Compare commits

...

1 Commits

Author SHA1 Message Date
alt-glitch
4e4f55a83e fix(nix): wire extraPackages into per-user profile for terminal visibility
extraPackages previously only added packages to the systemd service
PATH.  The terminal backend's login-shell snapshot rebuilds PATH from
NixOS system profiles (/etc/set-environment), so tools added via
extraPackages were invisible to terminal commands, skills, and cron
jobs — the entire use case.

Fix: when extraPackages is non-empty, also set
users.users.${cfg.user}.packages, which NixOS wires into
/etc/profiles/per-user/<user>/bin — a path that IS included in the
login-shell PATH.  The systemd service PATH still includes them too,
so both the process and spawned commands see the packages.

Also updates docs to reflect the corrected behavior.
2026-04-28 19:33:26 +05:30
2 changed files with 19 additions and 3 deletions

View File

@@ -455,7 +455,15 @@
extraPackages = mkOption {
type = types.listOf types.package;
default = [ ];
description = "Extra packages available on PATH.";
description = ''
Extra packages available to the agent terminal commands, skills,
cron jobs, and the service process all see them.
Implemented via the hermes user's per-user profile
(`/etc/profiles/per-user/${cfg.user}/bin`), which NixOS includes in
PATH for login shells. The packages are also added to the systemd
service PATH for direct process access.
'';
};
extraPlugins = mkOption {
@@ -640,6 +648,14 @@
}
# ── Warnings ──────────────────────────────────────────────────────
# ── Per-user profile for extraPackages ───────────────────────────
# Wire extraPackages into the hermes user's per-user profile so the
# login-shell snapshot (which rebuilds PATH from NixOS profiles) sees
# them. The systemd service PATH also includes them for direct access.
(lib.mkIf (cfg.extraPackages != []) {
users.users.${cfg.user}.packages = cfg.extraPackages;
})
(lib.mkIf (cfg.container.enable && !cfg.addToSystemPackages && cfg.container.hostUsers != []) {
warnings = [
''

View File

@@ -321,7 +321,7 @@ Quick reference for the most common things Nix users want to customize:
| Pass GPU access to container | `container.extraOptions` | `[ "--gpus" "all" ]` |
| Use Podman instead of Docker | `container.backend` | `"podman"` |
| Share state between host CLI and container | `container.hostUsers` | `[ "sidbin" ]` |
| Add tools to the service PATH (native only) | `extraPackages` | `[ pkgs.pandoc pkgs.imagemagick ]` |
| Make extra tools available to the agent | `extraPackages` | `[ pkgs.pandoc pkgs.imagemagick ]` |
| Use a custom base image | `container.image` | `"ubuntu:24.04"` |
| Override the hermes package | `package` | `inputs.hermes-agent.packages.${system}.default.override { ... }` |
| Change state directory | `stateDir` | `"/opt/hermes"` |
@@ -807,7 +807,7 @@ nix build .#checks.x86_64-linux.config-roundtrip # merge script preserves use
| Option | Type | Default | Description |
|---|---|---|---|
| `extraArgs` | `listOf str` | `[]` | Extra args for `hermes gateway` |
| `extraPackages` | `listOf package` | `[]` | Extra packages on service PATH (native mode only) |
| `extraPackages` | `listOf package` | `[]` | Extra packages available to the agent — terminal commands, skills, cron jobs, and the service process. Installed into the hermes user's per-user profile |
| `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` |
| `restart` | `str` | `"always"` | systemd `Restart=` policy |