Run davmail with podman container
Enable all accounts by default Add easy switch to disable if needed
This commit is contained in:
parent
ae7da08fa3
commit
171eda1d70
|
@ -26,6 +26,7 @@
|
||||||
proton = let
|
proton = let
|
||||||
host = "127.0.0.1";
|
host = "127.0.0.1";
|
||||||
tls.enable = false;
|
tls.enable = false;
|
||||||
|
accountEnabled = true;
|
||||||
in rec {
|
in rec {
|
||||||
inherit realName;
|
inherit realName;
|
||||||
primary = lib.mkDefault true;
|
primary = lib.mkDefault true;
|
||||||
|
@ -44,7 +45,7 @@
|
||||||
passwordCommand =
|
passwordCommand =
|
||||||
"${pkgs.libsecret}/bin/secret-tool lookup email ${userName}";
|
"${pkgs.libsecret}/bin/secret-tool lookup email ${userName}";
|
||||||
imapnotify = {
|
imapnotify = {
|
||||||
enable = true;
|
enable = lib.mkDefault accountEnabled;
|
||||||
boxes = [ "INBOX" ];
|
boxes = [ "INBOX" ];
|
||||||
onNotify = "${pkgs.isync}/bin/mbsync --pull proton:INBOX";
|
onNotify = "${pkgs.isync}/bin/mbsync --pull proton:INBOX";
|
||||||
onNotifyPost =
|
onNotifyPost =
|
||||||
|
@ -56,7 +57,7 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
mbsync = {
|
mbsync = {
|
||||||
enable = true;
|
enable = lib.mkDefault accountEnabled;
|
||||||
create = "both";
|
create = "both";
|
||||||
expunge = "both";
|
expunge = "both";
|
||||||
remove = "both";
|
remove = "both";
|
||||||
|
@ -65,15 +66,16 @@
|
||||||
extraConfig.account.AuthMechs = "LOGIN";
|
extraConfig.account.AuthMechs = "LOGIN";
|
||||||
};
|
};
|
||||||
msmtp = {
|
msmtp = {
|
||||||
enable = true;
|
enable = lib.mkDefault accountEnabled;
|
||||||
extraConfig = {
|
extraConfig = {
|
||||||
tls = "off";
|
tls = "off";
|
||||||
auth = "login";
|
auth = "login";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
mu.enable = true;
|
mu.enable = lib.mkDefault accountEnabled;
|
||||||
};
|
};
|
||||||
icloud = rec {
|
icloud = let accountEnabled = true;
|
||||||
|
in rec {
|
||||||
inherit realName;
|
inherit realName;
|
||||||
primary = lib.mkDefault false; # TEMP until proton is fixed
|
primary = lib.mkDefault false; # TEMP until proton is fixed
|
||||||
maildir.path = "iCloud";
|
maildir.path = "iCloud";
|
||||||
|
@ -84,7 +86,7 @@
|
||||||
passwordCommand =
|
passwordCommand =
|
||||||
"${pkgs.libsecret}/bin/secret-tool lookup email ${userName}";
|
"${pkgs.libsecret}/bin/secret-tool lookup email ${userName}";
|
||||||
imapnotify = {
|
imapnotify = {
|
||||||
enable = true;
|
enable = lib.mkDefault accountEnabled;
|
||||||
boxes = [ "INBOX" ];
|
boxes = [ "INBOX" ];
|
||||||
onNotify = "${pkgs.isync}/bin/mbsync --pull icloud:INBOX";
|
onNotify = "${pkgs.isync}/bin/mbsync --pull icloud:INBOX";
|
||||||
onNotifyPost =
|
onNotifyPost =
|
||||||
|
@ -92,19 +94,20 @@
|
||||||
extraConfig.wait = 300;
|
extraConfig.wait = 300;
|
||||||
};
|
};
|
||||||
mbsync = {
|
mbsync = {
|
||||||
enable = true;
|
enable = lib.mkDefault accountEnabled;
|
||||||
create = "both";
|
create = "both";
|
||||||
expunge = "both";
|
expunge = "both";
|
||||||
remove = "both";
|
remove = "both";
|
||||||
patterns = [ "*" "!Junk" ];
|
patterns = [ "*" "!Junk" ];
|
||||||
subFolders = "Verbatim";
|
subFolders = "Verbatim";
|
||||||
};
|
};
|
||||||
msmtp.enable = true;
|
msmtp.enable = lib.mkDefault accountEnabled;
|
||||||
mu.enable = true;
|
mu.enable = lib.mkDefault accountEnabled;
|
||||||
};
|
};
|
||||||
ukaea = let
|
ukaea = let
|
||||||
host = "127.0.0.1";
|
host = "127.0.0.1";
|
||||||
tls.enable = false;
|
tls.enable = false;
|
||||||
|
accountEnabled = true;
|
||||||
in rec {
|
in rec {
|
||||||
inherit realName;
|
inherit realName;
|
||||||
primary = lib.mkDefault false;
|
primary = lib.mkDefault false;
|
||||||
|
@ -123,6 +126,7 @@
|
||||||
passwordCommand =
|
passwordCommand =
|
||||||
"${pkgs.libsecret}/bin/secret-tool lookup email ${userName}";
|
"${pkgs.libsecret}/bin/secret-tool lookup email ${userName}";
|
||||||
imapnotify = {
|
imapnotify = {
|
||||||
|
enable = lib.mkDefault accountEnabled;
|
||||||
boxes = [ "INBOX" ];
|
boxes = [ "INBOX" ];
|
||||||
onNotify = "${pkgs.isync}/bin/mbsync --pull ukaea:INBOX";
|
onNotify = "${pkgs.isync}/bin/mbsync --pull ukaea:INBOX";
|
||||||
onNotifyPost =
|
onNotifyPost =
|
||||||
|
@ -134,6 +138,7 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
mbsync = {
|
mbsync = {
|
||||||
|
enable = lib.mkDefault accountEnabled;
|
||||||
create = "both";
|
create = "both";
|
||||||
expunge = "both";
|
expunge = "both";
|
||||||
remove = "both";
|
remove = "both";
|
||||||
|
@ -143,9 +148,11 @@
|
||||||
extraConfig.account.AuthMechs = "LOGIN";
|
extraConfig.account.AuthMechs = "LOGIN";
|
||||||
};
|
};
|
||||||
msmtp.extraConfig = {
|
msmtp.extraConfig = {
|
||||||
|
enable = lib.mkDefault accountEnabled;
|
||||||
tls = "off";
|
tls = "off";
|
||||||
auth = "login";
|
auth = "login";
|
||||||
};
|
};
|
||||||
|
mu.enable = lib.mkDefault accountEnabled;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -159,8 +166,7 @@
|
||||||
After = [ "network-online.target" ];
|
After = [ "network-online.target" ];
|
||||||
RequiresMountsFor = "%t/containers";
|
RequiresMountsFor = "%t/containers";
|
||||||
};
|
};
|
||||||
Service = let name = "protonmail-bridge";
|
Service = {
|
||||||
in {
|
|
||||||
Environment = "PODMAN_SYSTEMD_UNIT=%n";
|
Environment = "PODMAN_SYSTEMD_UNIT=%n";
|
||||||
Restart = "always";
|
Restart = "always";
|
||||||
TimeoutStopSec = 70;
|
TimeoutStopSec = 70;
|
||||||
|
@ -196,12 +202,40 @@
|
||||||
};
|
};
|
||||||
davmail = lib.mkIf config.accounts.email.accounts.ukaea.mbsync.enable {
|
davmail = lib.mkIf config.accounts.email.accounts.ukaea.mbsync.enable {
|
||||||
Unit = {
|
Unit = {
|
||||||
Description = "DavMail";
|
Description = "Podman container-davmail.service";
|
||||||
After = [ "network.target" ];
|
Documentation = [ "man:podman-generate-systemd(1)" ];
|
||||||
|
Wants = [ "network-online.target" ];
|
||||||
|
After = [ "network-online.target" ];
|
||||||
|
RequiresMountsFor = "%t/containers";
|
||||||
};
|
};
|
||||||
Service = {
|
Service = {
|
||||||
|
Environment = "PODMAN_SYSTEMD_UNIT=%n";
|
||||||
Restart = "always";
|
Restart = "always";
|
||||||
ExecStart = "${pkgs.davmail}/bin/davmail -notray";
|
TimeoutStopSec = 70;
|
||||||
|
ExecStart = ''
|
||||||
|
${pkgs.podman}/bin/podman run \
|
||||||
|
--cidfile=%t/%n.ctr-id \
|
||||||
|
--cgroups=no-conmon \
|
||||||
|
--rm \
|
||||||
|
--sdnotify=conmon \
|
||||||
|
--replace \
|
||||||
|
-d \
|
||||||
|
--name=davmail \
|
||||||
|
-p 127.0.0.1:1026:1025 \
|
||||||
|
-p 127.0.0.1:1144:1143 \
|
||||||
|
-p 127.0.0.1:1080:1080 connectical/davmail
|
||||||
|
'';
|
||||||
|
ExecStop = ''
|
||||||
|
${pkgs.podman}/bin/podman stop \
|
||||||
|
--ignore -t 10 \
|
||||||
|
--cidfile=%t/%n.ctr-id'';
|
||||||
|
ExecStopPost = ''
|
||||||
|
${pkgs.podman}/bin/podman rm \
|
||||||
|
-f \
|
||||||
|
--ignore -t 10 \
|
||||||
|
--cidfile=%t/%n.ctr-id'';
|
||||||
|
Type = "notify";
|
||||||
|
NotifyAccess = "all";
|
||||||
};
|
};
|
||||||
Install.WantedBy = [
|
Install.WantedBy = [
|
||||||
"graphical-session.target"
|
"graphical-session.target"
|
||||||
|
|
Loading…
Reference in a new issue