From 5c36071043dfd80bf0b7f8b96cb93fbcec4bcad4 Mon Sep 17 00:00:00 2001 From: zerone0x Date: Wed, 8 Apr 2026 20:15:40 +0800 Subject: [PATCH] fix(nix): export HERMES_HOME system-wide when addToSystemPackages is true The `addToSystemPackages` option's documentation (and the `:::tip` block in `website/docs/getting-started/nix-setup.md`) promises that enabling it both puts the `hermes` CLI on PATH and sets `HERMES_HOME` system-wide so interactive shells share state with the gateway service. The module only did the former, so running `hermes` in a user shell silently created a separate `~/.hermes/` directory instead of the managed `${stateDir}/.hermes`. Implement the documented behavior by also setting `environment.variables.HERMES_HOME = "${cfg.stateDir}/.hermes"` in the same mkIf block, and update the option description to match. Fixes #6044 --- nix/nixosModules.nix | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/nix/nixosModules.nix b/nix/nixosModules.nix index acf9a6e9d5..13f4e532d5 100644 --- a/nix/nixosModules.nix +++ b/nix/nixosModules.nix @@ -464,7 +464,11 @@ addToSystemPackages = mkOption { type = types.bool; default = false; - description = "Add hermes CLI to environment.systemPackages."; + description = '' + Add the hermes CLI to environment.systemPackages and export + HERMES_HOME system-wide (via environment.variables) so interactive + shells share state with the gateway service. + ''; }; # ── OCI Container (opt-in) ────────────────────────────────────────── @@ -545,8 +549,12 @@ }) # ── Host CLI ────────────────────────────────────────────────────── + # Add the hermes CLI to system PATH and export HERMES_HOME system-wide + # so interactive shells share state (sessions, skills, cron) with the + # gateway service instead of creating a separate ~/.hermes/. (lib.mkIf cfg.addToSystemPackages { environment.systemPackages = [ cfg.package ]; + environment.variables.HERMES_HOME = "${cfg.stateDir}/.hermes"; }) # ── Directories ───────────────────────────────────────────────────