1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-11-08 19:46:05 +01:00

protonmail-bridge: init module

This commit is contained in:
Epix 2025-08-13 16:31:32 -05:00 committed by Austin Horstman
parent 8275e5d315
commit 1daeb0638a
5 changed files with 119 additions and 0 deletions

View file

@ -0,0 +1,13 @@
{ pkgs, ... }:
{
time = "2025-08-13T21:34:57+00:00";
condition = pkgs.stdenv.hostPlatform.isLinux;
message = ''
A new module is available: 'services.protonmail-bridge'.
ProtonMail Bridge is a desktop application that runs in the background,
encrypting and decrypting messages as they enter and leave your computer.
It lets you add your ProtonMail account to your favorite email client via
IMAP/SMTP by creating a local email server on your computer.
'';
}

View file

@ -0,0 +1,71 @@
{
config,
lib,
pkgs,
...
}:
let
cfg = config.services.protonmail-bridge;
in
{
meta.maintainers = with lib.hm.maintainers; [ epixtm ];
options.services.protonmail-bridge = {
enable = lib.mkEnableOption "ProtonMail Bridge";
package = lib.mkPackageOption pkgs "protonmail-bridge" { };
extraPackages = lib.mkOption {
type = lib.types.listOf lib.types.package;
default = [ ];
example = lib.literalExpression "with pkgs; [ pass gnome-keyring ]";
description = "List of derivations to place in ProtonMail Bridge's service path.";
};
logLevel = lib.mkOption {
type = lib.types.nullOr (
lib.types.enum [
"panic"
"fatal"
"error"
"warn"
"info"
"debug"
]
);
default = null;
description = ''
Log level of the ProtonMail Bridge service.
If set to null, the service uses its default log level.
'';
};
};
config = lib.mkIf cfg.enable {
assertions = [
(lib.hm.assertions.assertPlatform "services.protonmail-bridge" pkgs lib.platforms.linux)
];
home.packages = [ cfg.package ];
systemd.user.services.protonmail-bridge = {
Unit = {
Description = "ProtonMail Bridge";
After = [ "graphical-session.target" ];
};
Service = {
Environment = lib.mkIf (cfg.extraPackages != [ ]) [ "PATH=${lib.makeBinPath cfg.extraPackages}" ];
ExecStart =
"${lib.getExe cfg.package} --noninteractive"
+ lib.optionalString (cfg.logLevel != null) " --log-level ${cfg.logLevel}";
Restart = "always";
};
Install = {
WantedBy = [ "graphical-session.target" ];
};
};
};
}

View file

@ -0,0 +1,19 @@
{ pkgs, ... }:
{
services.protonmail-bridge = {
enable = true;
package = pkgs.protonmail-bridge-gui;
extraPackages = with pkgs; [
gnome-keyring
];
logLevel = "info";
};
nmt.script = ''
local service="home-files/.config/systemd/user/protonmail-bridge.service"
assertFileExists $service
assertFileRegex $service 'Environment=PATH=.*gnome-keyring.*'
assertFileRegex $service 'ExecStart=.*/protonmail-bridge-gui --noninteractive --log-level info'
'';
}

View file

@ -0,0 +1,5 @@
{ lib, pkgs, ... }:
lib.optionalAttrs pkgs.stdenv.hostPlatform.isLinux {
protonmail-bridge-basic-configuration = ./basic-configuration.nix;
protonmail-bridge-empty-settings = ./empty-settings.nix;
}

View file

@ -0,0 +1,11 @@
{
services.protonmail-bridge.enable = true;
nmt.script = ''
local service="home-files/.config/systemd/user/protonmail-bridge.service"
assertFileExists $service
assertFileNotRegex $service 'Environment=PATH=.*'
assertFileRegex $service 'ExecStart=.*/protonmail-bridge --noninteractive'
'';
}