From 8b13219861f316ca4133a22f25069da50391f82f Mon Sep 17 00:00:00 2001 From: Grigory Shipunov Date: Mon, 13 Feb 2023 14:31:11 +0100 Subject: [PATCH] add service to flush the msmtp queue --- modules/mail/default.nix | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/modules/mail/default.nix b/modules/mail/default.nix index 4f77a8d..71b195f 100644 --- a/modules/mail/default.nix +++ b/modules/mail/default.nix @@ -8,7 +8,6 @@ in msmtp neomutt notmuch - pass w3m links2 ]; @@ -81,6 +80,7 @@ in systemd.user = { + # Service and timer to sync imap to local maildir services.mbsync = { enable = true; after = [ "graphical.target" "network-online.target" ]; @@ -102,5 +102,27 @@ in }; }; + # service and timer to flush the msmtp queue + services.flush-msmtpq = { + enable = true; + after = [ "graphical.target" "network-online.target" ]; + script = '' + ${pkgs.msmtp}/bin/msmtp-queue -r + ''; + serviceConfig = { + Type = "oneshot"; + }; + }; + + timers.flush-msmtpq = { + enable = true; + wantedBy = [ "timers.target" ]; + timerConfig = { + Unit = "flush-msmtpq.service"; + OnBootSec = "11m"; + OnUnitInactiveSec = "13m"; + }; + }; + }; }