From 5edf9bd76ffb0ac02bbd4d70c3c330d4267b5d78 Mon Sep 17 00:00:00 2001 From: Bruno Inec Date: Wed, 18 Jan 2023 15:22:08 +0100 Subject: [PATCH] Apply suggestion Co-authored-by: Aaron Andersen --- nixos/modules/services/mail/goeland.nix | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) 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; };