diff --git a/nixos/modules/services/mail/goeland.nix b/nixos/modules/services/mail/goeland.nix index de2f7b457d7a..c407ffafcf18 100644 --- a/nixos/modules/services/mail/goeland.nix +++ b/nixos/modules/services/mail/goeland.nix @@ -40,13 +40,17 @@ in services.goeland.settings.database = "${cfg.stateDir}/goeland.db"; systemd.services.goeland = { - serviceConfig = let confFile = tomlFormat.generate "config.toml" cfg.settings; in { - ExecStart = "${pkgs.goeland}/bin/goeland run -c ${confFile}"; - User = "goeland"; - Group = "goeland"; - StateDirectory = "goeland"; - StateDirectoryMode = "0750"; - }; + serviceConfig = let confFile = tomlFormat.generate "config.toml" cfg.settings; in mkMerge [ + { + ExecStart = "${pkgs.goeland}/bin/goeland run -c ${confFile}"; + User = "goeland"; + Group = "goeland"; + } + (mkIf (cfg.stateDir == "/var/lib/goeland") { + StateDirectory = "goeland"; + StateDirectoryMode = "0750"; + }) + ]; startAt = cfg.schedule; };