35 lines
926 B
Nix
35 lines
926 B
Nix
{
|
|
pkgs,
|
|
lib,
|
|
config,
|
|
...
|
|
}: let
|
|
cfg = config.services.protonmailBridge;
|
|
in {
|
|
options.services.protonmailBridge = with lib; {
|
|
enable = mkEnableOption "ProtonMail Bridge application";
|
|
};
|
|
|
|
config = lib.mkIf cfg.enable {
|
|
systemd.user.services."protonmail-bridge" = {
|
|
Unit = {
|
|
Description = "ProtonMail Bridge application";
|
|
After = ["network.target"];
|
|
};
|
|
Service = {
|
|
# This is a cheap option to force-unlock the keyring
|
|
ExecStartPre = ''
|
|
${pkgs.libsecret}/bin/secret-tool store --label='keyring-test' test test
|
|
${pkgs.libsecret}/bin/secret-tool clear test test
|
|
'';
|
|
ExecStart = ''
|
|
${pkgs.protonmail-bridge}/bin/protonmail-bridge --no-window --noninteractive --log-level warn
|
|
'';
|
|
Restart = "always";
|
|
RestartSec = "1min";
|
|
};
|
|
Install.WantedBy = ["default.target"];
|
|
};
|
|
};
|
|
}
|