Commit f70547de authored by Felix Singer's avatar Felix Singer
Browse files

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: default avatarFelix Singer <felixsinger@posteo.net>
parent 35e7219c
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -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}";