Switch to using protonmail-bridge directly, instead of container

This commit is contained in:
Evie Litherland-Smith 2024-02-03 06:25:12 +00:00
parent 66c7024bfb
commit db519c6398

View file

@ -135,39 +135,14 @@
in {
protonmail-bridge = lib.mkIf emailAccounts.proton.mbsync.enable {
Unit = {
Description = "Podman container-protonmail-bridge.service";
Documentation = ["man:podman-generate-systemd(1)"];
Description = "Proton Mail Bridge";
Wants = ["network-online.target"];
After = ["network-online.target"];
RequiresMountsFor = "%t/containers";
};
Service = {
Environment = ["PODMAN_SYSTEMD_UNIT=%n" "PATH=/run/wrappers/bin/:$PATH"];
Environment = ["PATH=/run/current-system/sw/bin/:$PATH"];
Restart = "always";
TimeoutStopSec = 70;
ExecStart = ''
${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";
ExecStart = "${pkgs.protonmail-bridge}/bin/protonmail-bridge -n";
};
Install.WantedBy = ["default.target"];
};