Unverified Commit a0a63aa8 authored by Pol Dellaiera's avatar Pol Dellaiera Committed by GitHub
Browse files

Merge pull request #332593 from mzacho/master

nixos/modules/services/mail: add protonmail-bridge service
parents 4d1171eb 45b7c17b
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -14169,6 +14169,12 @@
    githubId = 9636071;
    name = "Myrl Hex";
  };
  mzacho = {
    email = "nixpkgs@martinzacho.net";
    github = "mzacho";
    githubId = 16916972;
    name = "Martin Zacho";
  };
  n00b0ss = {
    email = "nixpkgs@n00b0ss.de";
    github = "n00b0ss";
+2 −0
Original line number Diff line number Diff line
@@ -81,6 +81,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
@@ -674,6 +674,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
+60 −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 ];
  };
  meta.maintainers = with lib.maintainers; [ mzacho ];
}