nixos/modules/services/mail: add protonmail-bridge

This commit is contained in:
Martin Zacho 2024-08-06 00:57:22 +02:00
parent 75fa97a285
commit 91e1c5349e
No known key found for this signature in database
3 changed files with 62 additions and 0 deletions

View File

@ -74,6 +74,8 @@
- [Rathole](https://github.com/rapiz1/rathole), a lightweight and high-performance reverse proxy for NAT traversal. Available as [services.rathole](#opt-services.rathole.enable).
- [Proton Mail bridge](https://proton.me/mail/bridge), a desktop application that runs in the background, encrypting and decrypting messages as they enter and leave your computer. It lets you add your Proton Mail account to your favorite email client via IMAP/SMTP by creating a local email server on your computer.
## Backward Incompatibilities {#sec-release-24.11-incompatibilities}
- `transmission` package has been aliased with a `trace` warning to `transmission_3`. Since [Transmission 4 has been released last year](https://github.com/transmission/transmission/releases/tag/4.0.0), and Transmission 3 will eventually go away, it was decided perform this warning alias to make people aware of the new version. The `services.transmission.package` defaults to `transmission_3` as well because the upgrade can cause data loss in certain specific usage patterns (examples: [#5153](https://github.com/transmission/transmission/issues/5153), [#6796](https://github.com/transmission/transmission/issues/6796)). Please make sure to back up to your data directory per your usage:

View File

@ -673,6 +673,7 @@
./services/mail/postfixadmin.nix
./services/mail/postgrey.nix
./services/mail/postsrsd.nix
./services/mail/protonmail-bridge.nix
./services/mail/public-inbox.nix
./services/mail/roundcube.nix
./services/mail/rspamd.nix

View File

@ -0,0 +1,59 @@
{
config,
lib,
pkgs,
...
}:
let
cfg = config.services.protonmail-bridge;
in
{
options.services.protonmail-bridge = {
enable = lib.mkEnableOption "protonmail bridge";
package = lib.mkPackageOption pkgs "protonmail-bridge" { };
path = lib.mkOption {
type = lib.types.listOf lib.types.path;
default = [ ];
example = lib.literalExpression "with pkgs; [ pass gnome-keyring ]";
description = "List of derivations to put in protonmail-bride's path.";
};
logLevel = lib.mkOption {
type = lib.types.nullOr (
lib.types.enum [
"panic"
"fatal"
"error"
"warn"
"info"
"debug"
]
);
default = null;
description = "Log level of the Proton Mail Bridge service. If set to null then the service uses it's default log level.";
};
};
config = lib.mkIf cfg.enable {
systemd.user.services.protonmail-bridge = {
description = "protonmail bridge";
wantedBy = [ "graphical-session.target" ];
after = [ "graphical-session.target" ];
serviceConfig =
let
logLevel = lib.optionalString (cfg.logLevel != null) "--log-level ${cfg.logLevel}";
in
{
ExecStart = "${lib.getExe cfg.package} --noninteractive ${logLevel}";
Restart = "always";
};
path = cfg.path;
};
environment.systemPackages = [ cfg.package ];
};
}