nixos/weechat: Set up state directory

In preparation for dropping the user home directory, set up the state
directory manually. Use the systemd unit options when /var/lib/weechat
is used and use systemd-tmpfiles for all other locations. Not sure if it
makes any difference. However, it seems systemd tends to control its
directories in /var/lib and so it might make more sense to use the
existing options of the systemd unit.

This doesn't change the current behaviour.

Signed-off-by: Felix Singer <felixsinger@posteo.net>
This commit is contained in:
Felix Singer
2025-02-05 02:49:21 +01:00
parent 35e7219c0b
commit f70547debc
+12
View File
@@ -44,10 +44,22 @@ in
};
};
systemd.tmpfiles.settings."weechat" = {
"${cfg.root}" = lib.mkIf (cfg.root != "/var/lib/weechat") {
d = {
user = "weechat";
group = "weechat";
mode = "750";
};
};
};
systemd.services.weechat = {
serviceConfig = {
User = "weechat";
Group = "weechat";
StateDirectory = lib.mkIf (cfg.root == "/var/lib/weechat") "weechat";
StateDirectoryMode = 750;
RemainAfterExit = "yes";
};
script = "exec ${config.security.wrapperDir}/screen -Dm -S ${cfg.sessionName} ${cfg.binary} --dir ${cfg.root}";