Unverified Commit 91e1c534 authored by Martin Zacho's avatar Martin Zacho
Browse files

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

parent 75fa97a2
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -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:
+1 −0
Original line number Diff line number Diff line
@@ -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
+59 −0
Original line number Diff line number Diff line
{
  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 ];
  };
}