From f51197afca78ac350c42031597b3ead684aa7929 Mon Sep 17 00:00:00 2001 From: Hermenix Date: Thu, 1 Oct 2026 12:30:04 +0000 Subject: [PATCH] module: one tmpfiles definition, merged Adding the broker's state directory as a second assignment to systemd.tmpfiles.settings does not evaluate at all (the option takes one definition), which broke every check that enables sessions. Both reasons to write a tmpfiles entry now live in one lib.mkMerge. --- nix/module.nix | 47 ++++++++++++++++++++++++++--------------------- 1 file changed, 26 insertions(+), 21 deletions(-) diff --git a/nix/module.nix b/nix/module.nix index c132f1d..a9ed704 100644 --- a/nix/module.nix +++ b/nix/module.nix @@ -431,17 +431,32 @@ in { services.hyprland-headless-stream.package = lib.mkDefault (pkgs.callPackage ./package.nix {}); - # The broker's state directory, when it is not a systemd `StateDirectory=` - # (which cannot be pointed anywhere but /var/lib/). Created here rather - # than by the daemon so its ownership is declarative and it survives a - # restart of the unit with the right mode. - systemd.tmpfiles.settings = lib.mkIf cfg.sessions.enable { - "10-hhstream-sessions".${cfg.sessions.stateDir}.d = { - user = cfg.sessions.user; - group = cfg.sessions.group; - mode = "0700"; - }; - }; + # The broker's state directory and the moved socket directory are two + # different reasons to write a tmpfiles entry, and this option takes one + # definition — so they are merged here rather than assigned twice (which + # does not evaluate at all). + systemd.tmpfiles.settings = lib.mkMerge [ + # The broker keeps the records it adopts on the way back up, its + # tombstones, and `events.jsonl`, the audit trail of every accepted + # command. It is declared here rather than left to the daemon so its owner + # and mode are declarative and survive a restart of the unit. + (lib.mkIf cfg.sessions.enable { + "10-hhstream-sessions".${cfg.sessions.stateDir}.d = { + user = cfg.sessions.user; + group = cfg.sessions.group; + mode = "0700"; + }; + }) + # Only needed when the socket was moved out of the runtime directory that + # `RuntimeDirectory=` already creates for us. + (lib.mkIf (socketDir != runtimeDir) { + "10-hyprland-headless-stream".${socketDir}.d = { + user = cfg.user; + group = cfg.group; + mode = "0750"; + }; + }) + ]; users.users.${cfg.user} = { isSystemUser = true; @@ -450,16 +465,6 @@ in { }; users.groups.${cfg.group} = {}; - # Only needed when the socket was moved out of the runtime directory that - # `RuntimeDirectory=` already creates for us. - systemd.tmpfiles.settings = lib.mkIf (socketDir != runtimeDir) { - "10-hyprland-headless-stream".${socketDir}.d = { - user = cfg.user; - group = cfg.group; - mode = "0750"; - }; - }; - systemd.services.hyprland-headless = { description = "Headless Hyprland session"; documentation = ["file://${hyprlandConf}"];