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.
This commit is contained in:
Hermenix committed 2026-10-01 12:30:04 +00:00
1 parent fc5112aa6a
commit f51197afca
1 file changed
+26 -21
+26 -21
View File
@@ -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/<name>). 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}"];