diff options
author | Andrey Arapov <arno@nixaid.com> | 2015-01-19 10:45:20 +0100 |
---|---|---|
committer | Luca Bruno <lucabru@src.gnome.org> | 2015-01-19 11:05:56 +0100 |
commit | 04be7262a62a413007fe6bf6e917a4e4d0f0df54 (patch) | |
tree | e2e570887e0224e45c7fc0789940d34dccaf6804 /nixos | |
parent | c163baca3bf09af9431bc2c00a642282f5e64776 (diff) | |
download | nixlib-04be7262a62a413007fe6bf6e917a4e4d0f0df54.tar nixlib-04be7262a62a413007fe6bf6e917a4e4d0f0df54.tar.gz nixlib-04be7262a62a413007fe6bf6e917a4e4d0f0df54.tar.bz2 nixlib-04be7262a62a413007fe6bf6e917a4e4d0f0df54.tar.lz nixlib-04be7262a62a413007fe6bf6e917a4e4d0f0df54.tar.xz nixlib-04be7262a62a413007fe6bf6e917a4e4d0f0df54.tar.zst nixlib-04be7262a62a413007fe6bf6e917a4e4d0f0df54.zip |
nixos/dovecot: added configFile option and default Restart on-failure, PR #5845
Absolute path is required when one has such postfix configuration where he/she needs to specify the actual (real) path to active dovecot config. Without this commit applied, the dovecot is running in such way: /nix/store/hashAAA-dovecot-ver/sbin/dovecot -F -c /nix/store/hashBBB-dovecot2.conf and postfix can't be aware of the value of "hashBBB" via services.postfix.extraConfig = '' ... ''; (it can only be aware of "hashAAA" with ${pkgs.dovecot} parameter) Also enable Restart on-failure. Edit: set RestartSec to 1s
Diffstat (limited to 'nixos')
-rw-r--r-- | nixos/modules/services/mail/dovecot.nix | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/nixos/modules/services/mail/dovecot.nix b/nixos/modules/services/mail/dovecot.nix index 1fb7102e7f3e..50ff1b38db12 100644 --- a/nixos/modules/services/mail/dovecot.nix +++ b/nixos/modules/services/mail/dovecot.nix @@ -45,8 +45,6 @@ let pop3_uidl_format = %08Xv%08Xu '' + cfg.extraConfig; - confFile = pkgs.writeText "dovecot.conf" dovecotConf; - in { @@ -88,6 +86,12 @@ in description = "Additional entries to put verbatim into Dovecot's config file."; }; + configFile = mkOption { + default = null; + description = "Config file used for the whole dovecot configuration."; + apply = v: if v != null then v else pkgs.writeText "dovecot.conf" dovecotConf; + }; + mailLocation = mkOption { default = "maildir:/var/spool/mail/%u"; /* Same as inbox, as postfix */ example = "maildir:~/mail:INBOX=/var/spool/mail/%u"; @@ -144,10 +148,11 @@ in gid = config.ids.gids.dovecot2; }; - jobs.dovecot2 = + systemd.services.dovecot2 = { description = "Dovecot IMAP/POP3 server"; - startOn = "started networking"; + after = [ "network.target" ]; + wantedBy = [ "multi-user.target" ]; preStart = '' @@ -155,7 +160,13 @@ in ${pkgs.coreutils}/bin/chown -R ${cfg.user}:${cfg.group} /var/run/dovecot2 ''; - exec = "${pkgs.dovecot}/sbin/dovecot -F -c ${confFile}"; + serviceConfig = { + ExecStart = "${pkgs.dovecot}/sbin/dovecot -F -c ${cfg.configFile}"; + Restart = "on-failure"; + RestartSec = "1s"; + StartLimitInterval = "1min"; + }; + }; environment.systemPackages = [ pkgs.dovecot ]; |