diff options
| author | tv <tv@krebsco.de> | 2026-11-20 01:37:56 +0000 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-11-20 02:58:09 +0100 |
| commit | 7878d9eaa173adec4a586c6e0fd71d8058abdf3e (patch) | |
| tree | 86df698165d97b3ed4b3bb85c19385c10a9df9e7 | |
configs/hermes: add Hermes Agent
Hermes Agent from its own NixOS module, imported through flake-compat,
with what this guest needs on top:
- nixos-init doesn't run activation scripts, so the module's setup runs
as hermes-agent-setup.service before the gateway
- state lives on the rw-store drive, as /var is a tmpfs
- the hermes user doesn't linger, as users.manageLingering is off
(hermes' cron needs a user manager; nothing else does)
The API key comes from /xchg/hermes.env.
| -rw-r--r-- | configs/hermes.nix | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/configs/hermes.nix b/configs/hermes.nix new file mode 100644 index 0000000..cac976d --- /dev/null +++ b/configs/hermes.nix @@ -0,0 +1,50 @@ +# Hermes Agent (Nous Research), with its own NixOS module, fitted to this +# guest. Put ANTHROPIC_API_KEY=... into hermes.env in /xchg on the host; +# run hermes on the console. +{ config, ... }: +let + # Not a flake input: flake-compat evaluates hermes-agent's flake, with its + # flake.lock, using plain nix. Bump rev and sha256 together. + flake-compat = builtins.fetchTarball { + url = "https://github.com/edolstra/flake-compat/archive/5edf11c44bc78a0d334f6334cdaf7d60d732daab.tar.gz"; + sha256 = "0yqfa6rx8md81bcn4szfp0hjq2f3h9i8zjzhqqyfqdkrj5559nmw"; + }; + hermes-agent = (import flake-compat { + src = builtins.fetchTarball { + url = "https://github.com/NousResearch/hermes-agent/archive/9f47677483d1b4de4d1a88d37b3b7ca18b18b215.tar.gz"; + sha256 = "1xpvwgmn5slmfc2zsr5bfgywz1c6dqx3i5qy6ppbdvg1j2vngx71"; + }; + }).defaultNix; +in +{ + imports = [ hermes-agent.nixosModules.default ]; + + services.hermes-agent = { + enable = true; + # /var is a tmpfs. This is on the only drive that can outlive a boot, + # like nix's database, see /nix/var. + stateDir = "/nix/.rw-store/hermes"; + settings.model = { + provider = "anthropic"; + default = "claude-opus-5-5"; + }; + # Read at boot; a missing file only gets a warning. + environmentFiles = [ "/xchg/hermes.env" ]; + # hermes on the console shares the service's state. + addToSystemPackages = true; + }; + + # nixos-init doesn't run activation scripts, and that's where the module + # creates the state and installs config.yaml and .env. + systemd.services.hermes-agent-setup = { + requiredBy = [ "hermes-agent.service" ]; + before = [ "hermes-agent.service" ]; + serviceConfig.Type = "oneshot"; + serviceConfig.RemainAfterExit = true; + script = config.system.activationScripts.hermes-agent-setup.text; + }; + + # users.manageLingering is off here. Without a user manager, hermes' + # cron can't run jobs; nothing else needs one. + users.users.hermes.linger = null; +} |
