diff options
| -rw-r--r-- | configs/hermes.nix | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/configs/hermes.nix b/configs/hermes.nix index c1a6cb6..ea50dbd 100644 --- a/configs/hermes.nix +++ b/configs/hermes.nix @@ -5,6 +5,14 @@ { config, lib, pkgs, ... }: let tmux = "${pkgs.tmux}/bin/tmux -S /run/hermes/tmux"; + # The provider plugin, installed by hermes-agent-setup, see there. + claude-subscription-directsdk = pkgs.runCommand "claude-subscription-directsdk" { } '' + cp -r ${builtins.fetchTarball { + url = "https://github.com/NousResearch/hermes-official-plugins/archive/80025332933bf84fb3c7b68f369d9fe59a771e98.tar.gz"; + sha256 = "1ivgwfqnhgpwsp204ljsm4jwcq00n8zs4pd5dgyx0crb3hdig3bq"; + }}/claude-subscription-directsdk $out + ''; + # Root's way (back) into hermes' tmux. hermes-attach = pkgs.writeShellScriptBin "hermes-attach" '' exec ${tmux} attach -t hermes @@ -80,14 +88,6 @@ in provider = "claude-subscription-directsdk-experimental"; default = "opus"; }; - extraPlugins = [ - (pkgs.runCommand "claude-subscription-directsdk" { } '' - cp -r ${builtins.fetchTarball { - url = "https://github.com/NousResearch/hermes-official-plugins/archive/80025332933bf84fb3c7b68f369d9fe59a771e98.tar.gz"; - sha256 = "1ivgwfqnhgpwsp204ljsm4jwcq00n8zs4pd5dgyx0crb3hdig3bq"; - }}/claude-subscription-directsdk $out - '') - ]; # The login is in ~/.claude, i.e. in stateDir. extraPackages = [ pkgs.claude-code ]; }; @@ -132,7 +132,18 @@ in before = [ "hermes-agent.service" ]; serviceConfig.Type = "oneshot"; serviceConfig.RemainAfterExit = true; - script = config.system.activationScripts.hermes-agent-setup.text; + script = config.system.activationScripts.hermes-agent-setup.text + '' + + # Not with extraPlugins, which links to the store: Hermes stages a + # provider plugin by copying it, mode included, and renaming the + # copy into another directory, which needs a writable directory to + # update its "..", and fails as hermes with the store's read-only + # one. So a writable copy instead. + p=${config.services.hermes-agent.stateDir}/.hermes/plugins/claude-subscription-directsdk + rm -rf "$p" + cp -r --no-preserve=mode ${claude-subscription-directsdk} "$p" + chown -R hermes:hermes "$p" + ''; }; # users.manageLingering is off here. Without a user manager, hermes' |
