Unverified Commit 3204e04a authored by NotAShelf's avatar NotAShelf
Browse files

nixos/wakapi: add `stateDir` and set service WorkingDirectory

For some reason, StateDirectory does not work very well with the sqlite format.
This acts as a workaround of such, and allows the service to alternatively work
in an alternative, user-created directory if the issue does arise again.

See https://github.com/muety/wakapi/issues/731 for context and
motivations for this change.
parent 6df24922
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -26,6 +26,14 @@ in
  options.services.wakapi = {
    enable = mkEnableOption "Wakapi";
    package = mkPackageOption pkgs "wakapi" { };
    stateDir = mkOption {
      type = types.path;
      default = "/var/lib/wakapi";
      description = ''
        The state directory where data is stored. Will also be used as the
        working directory for the wakapi service.
      '';
    };

    settings = mkOption {
      inherit (settingsFormat) type;
@@ -166,6 +174,8 @@ in
        RestrictNamespaces = true;
        RestrictRealtime = true;
        RestrictSUIDSGID = true;
        WorkingDirectory = cfg.stateDir;
        RuntimeDirectory = "wakapi";
        StateDirectory = "wakapi";
        StateDirectoryMode = "0700";
        Restart = "always";