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