From f70547debcc6de22ebc9cb9fdb042bf891e2be94 Mon Sep 17 00:00:00 2001 From: Felix Singer Date: Sat, 14 Dec 2024 01:12:36 +0100 Subject: [PATCH] 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 --- nixos/modules/services/misc/weechat.nix | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/nixos/modules/services/misc/weechat.nix b/nixos/modules/services/misc/weechat.nix index ec64920055b6..0c1c17c8fc15 100644 --- a/nixos/modules/services/misc/weechat.nix +++ b/nixos/modules/services/misc/weechat.nix @@ -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}";