From 3be3ae00ca23ee34b7c7c32e311ea3d23fe15ca0 Mon Sep 17 00:00:00 2001 From: tv Date: Sat, 21 Nov 2026 02:22:33 +0000 Subject: configs/hermes: a normal user, with a 0700 home hermes was the module's system user, with its home group-writable and setgid (2770), for the module's hostUsers, which aren't used here: anyone in the group could read the Claude login and hermes.env's secrets. Now it's a normal user (still in its group hermes), and its home is 0700: systemd-tmpfiles takes the first line for a path and ignores the module's (with a warning), and hermes-agent-setup undoes the module script's chmod 2770. --- configs/hermes.nix | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'configs/hermes.nix') diff --git a/configs/hermes.nix b/configs/hermes.nix index 3cf726a..633d804 100644 --- a/configs/hermes.nix +++ b/configs/hermes.nix @@ -152,9 +152,19 @@ in nixpkgs.config.allowUnfreePredicate = pkg: lib.getName pkg == "claude-code"; fc.home.required = true; - # /home is mounted after users get created; the module's tmpfiles create - # the home instead. - users.users.hermes.createHome = lib.mkForce false; + # A normal user, with a home like any other. /home is mounted after + # users get created, see tmpfiles below. + users.users.hermes = { + isSystemUser = lib.mkForce false; + isNormalUser = true; + createHome = lib.mkForce false; + }; + # 0700 rather than the module's 2770 (setgid, for its hostUsers, which + # aren't used here): before it, so it's the one systemd-tmpfiles takes + # (it ignores later lines for the same path, with a warning). + systemd.tmpfiles.rules = lib.mkBefore [ + "d ${config.services.hermes-agent.stateDir} 0700 hermes hermes -" + ]; systemd.services.hermes-agent-setup.unitConfig.RequiresMountsFor = config.services.hermes-agent.stateDir; systemd.services.hermes-agent.unitConfig.RequiresMountsFor = config.services.hermes-agent.stateDir; systemd.services.hermes-tmux.unitConfig.RequiresMountsFor = config.services.hermes-agent.stateDir; @@ -220,6 +230,9 @@ in # Writable for hermes, too, see HERMES_MANAGED below. chmod 0660 ${config.services.hermes-agent.stateDir}/.hermes/config.yaml + + # The module's script makes it 2770, see tmpfiles above. + chmod 0700 ${config.services.hermes-agent.stateDir} ''; }; -- cgit v1.3.1