summaryrefslogtreecommitdiffstats
path: root/configs
diff options
context:
space:
mode:
Diffstat (limited to 'configs')
-rw-r--r--configs/hermes.nix50
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;
+}