Fix protonmail-bridge
systemd service now runs a podman container for protonmail-bridge so it's isolated and works properly
This commit is contained in:
parent
55a6c3c281
commit
406d922c8b
|
@ -28,7 +28,7 @@
|
||||||
tls.enable = false;
|
tls.enable = false;
|
||||||
in rec {
|
in rec {
|
||||||
inherit realName;
|
inherit realName;
|
||||||
primary = lib.mkDefault false; # TEMP until fixed
|
primary = lib.mkDefault true;
|
||||||
maildir.path = "Proton";
|
maildir.path = "Proton";
|
||||||
imap = {
|
imap = {
|
||||||
inherit host tls;
|
inherit host tls;
|
||||||
|
@ -44,7 +44,7 @@
|
||||||
passwordCommand =
|
passwordCommand =
|
||||||
"${pkgs.libsecret}/bin/secret-tool lookup email ${userName}";
|
"${pkgs.libsecret}/bin/secret-tool lookup email ${userName}";
|
||||||
imapnotify = {
|
imapnotify = {
|
||||||
enable = false; # TEMP until fixed
|
enable = true;
|
||||||
boxes = [ "INBOX" ];
|
boxes = [ "INBOX" ];
|
||||||
onNotify = "${pkgs.isync}/bin/mbsync --pull proton:INBOX";
|
onNotify = "${pkgs.isync}/bin/mbsync --pull proton:INBOX";
|
||||||
onNotifyPost =
|
onNotifyPost =
|
||||||
|
@ -56,7 +56,7 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
mbsync = {
|
mbsync = {
|
||||||
enable = false; # TEMP until fixed
|
enable = true;
|
||||||
create = "both";
|
create = "both";
|
||||||
expunge = "both";
|
expunge = "both";
|
||||||
remove = "both";
|
remove = "both";
|
||||||
|
@ -65,17 +65,17 @@
|
||||||
extraConfig.account.AuthMechs = "LOGIN";
|
extraConfig.account.AuthMechs = "LOGIN";
|
||||||
};
|
};
|
||||||
msmtp = {
|
msmtp = {
|
||||||
enable = false; # TEMP until fixed
|
enable = true;
|
||||||
extraConfig = {
|
extraConfig = {
|
||||||
tls = "off";
|
tls = "off";
|
||||||
auth = "login";
|
auth = "login";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
mu.enable = false; # TEMP until fixed
|
mu.enable = true;
|
||||||
};
|
};
|
||||||
icloud = rec {
|
icloud = rec {
|
||||||
inherit realName;
|
inherit realName;
|
||||||
primary = lib.mkDefault true; # TEMP until proton is fixed
|
primary = lib.mkDefault false; # TEMP until proton is fixed
|
||||||
maildir.path = "iCloud";
|
maildir.path = "iCloud";
|
||||||
imap.host = "imap.mail.me.com";
|
imap.host = "imap.mail.me.com";
|
||||||
smtp.host = "smtp.mail.me.com";
|
smtp.host = "smtp.mail.me.com";
|
||||||
|
@ -153,14 +153,40 @@
|
||||||
protonmail-bridge =
|
protonmail-bridge =
|
||||||
lib.mkIf config.accounts.email.accounts.proton.mbsync.enable {
|
lib.mkIf config.accounts.email.accounts.proton.mbsync.enable {
|
||||||
Unit = {
|
Unit = {
|
||||||
Description = "Protonmail Bridge";
|
Description = "Podman container-protonmail-bridge.service";
|
||||||
After = [ "network.target" ];
|
Documentation = [ "man:podman-generate-systemd(1)" ];
|
||||||
|
Wants = [ "network-online.target" ];
|
||||||
|
After = [ "network-online.target" ];
|
||||||
|
RequiresMountsFor = "%t/containers";
|
||||||
};
|
};
|
||||||
Service = {
|
Service = let name = "protonmail-bridge";
|
||||||
|
in {
|
||||||
|
Environment = "PODMAN_SYSTEMD_UNIT=%n";
|
||||||
Restart = "always";
|
Restart = "always";
|
||||||
# Environment = "PATH=${pkgs.libsecret}/bin";
|
TimeoutStopSec = 70;
|
||||||
ExecStart =
|
ExecStart = ''
|
||||||
"${pkgs.protonmail-bridge}/bin/protonmail-bridge --noninteractive --log-level info";
|
${pkgs.podman}/bin/podman run \
|
||||||
|
--cidfile=%t/%n.ctr-id \
|
||||||
|
--cgroups=no-conmon \
|
||||||
|
--rm \
|
||||||
|
--sdnotify=conmon \
|
||||||
|
--replace \
|
||||||
|
-d \
|
||||||
|
--name=protonmail-bridge \
|
||||||
|
-v protonmail:/root \
|
||||||
|
-p 127.0.0.1:1025:25/tcp \
|
||||||
|
-p 127.0.0.1:1143:143/tcp shenxn/protonmail-bridge'';
|
||||||
|
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