From eeae2e69f30888f958a0ec786d453f7a86a6fd01 Mon Sep 17 00:00:00 2001 From: wi11-holdsworth <83637728+wi11-holdsworth@users.noreply.github.com> Date: Thu, 25 Sep 2025 18:23:31 +1000 Subject: [PATCH] feat: install proton bridge and aerc for email --- modules/home-manager/bundles/desktop.nix | 2 + modules/home-manager/features/aerc.nix | 20 ++++++ modules/home-manager/features/mail.nix | 70 ++++++++++++++++++++ modules/nixos/bundles/desktop.nix | 1 + modules/nixos/features/protonmail-bridge.nix | 17 +++++ 5 files changed, 110 insertions(+) create mode 100644 modules/home-manager/features/aerc.nix create mode 100644 modules/home-manager/features/mail.nix create mode 100644 modules/nixos/features/protonmail-bridge.nix diff --git a/modules/home-manager/bundles/desktop.nix b/modules/home-manager/bundles/desktop.nix index 8b8dcb3..c7365cb 100644 --- a/modules/home-manager/bundles/desktop.nix +++ b/modules/home-manager/bundles/desktop.nix @@ -9,7 +9,9 @@ in { config = lib.mkIf config.${feature}.enable { # keep-sorted start + aerc.enable = true; kitty.enable = true; + mail.enable = true; obsidian.enable = true; zellij.enable = true; # keep-sorted end diff --git a/modules/home-manager/features/aerc.nix b/modules/home-manager/features/aerc.nix new file mode 100644 index 0000000..d2138bc --- /dev/null +++ b/modules/home-manager/features/aerc.nix @@ -0,0 +1,20 @@ +{ + config, + lib, + ... +}: +let + feature = "aerc"; +in +{ + config = lib.mkIf config.${feature}.enable { + programs.aerc = { + enable = true; + extraConfig.general.unsafe-accounts-conf = true; + }; + }; + + imports = [ ]; + + options.${feature}.enable = lib.mkEnableOption "enables ${feature}"; +} diff --git a/modules/home-manager/features/mail.nix b/modules/home-manager/features/mail.nix new file mode 100644 index 0000000..1d33028 --- /dev/null +++ b/modules/home-manager/features/mail.nix @@ -0,0 +1,70 @@ +{ + config, + lib, + ... +}: +let + feature = "mail"; +in +{ + config = lib.mkIf config.${feature}.enable { + accounts.email = + let + certificatesFile = config.age.secrets.protonmail-cert.path; + in + { + inherit certificatesFile; + accounts = + let + # keep-sorted start block=yes + address = "willholdsworth@pm.me"; + authentication = "login"; + host = "127.0.0.1"; + tls = { + enable = false; + useStartTls = true; + inherit certificatesFile; + }; + # keep-sorted end + in + { + personal = { + enable = true; + # keep-sorted start block=yes + aerc = { + enable = true; + }; + imap = { + port = 1143; + inherit tls; + inherit authentication; + inherit host; + }; + inherit address; + passwordCommand = "cat ${config.age.secrets.protonmail-password.path}"; + primary = true; + realName = "Will Holdsworth"; + smtp = { + port = 1025; + inherit tls; + inherit authentication; + inherit host; + }; + userName = address; + # keep-sorted end + }; + }; + }; + + age.secrets = { + # keep-sorted start + "protonmail-cert".file = ../../../secrets/protonmail-cert.age; + "protonmail-password".file = ../../../secrets/protonmail-password.age; + # keep-sorted end + }; + }; + + imports = [ ]; + + options.${feature}.enable = lib.mkEnableOption "enables ${feature}"; +} diff --git a/modules/nixos/bundles/desktop.nix b/modules/nixos/bundles/desktop.nix index 212118d..ddd135c 100644 --- a/modules/nixos/bundles/desktop.nix +++ b/modules/nixos/bundles/desktop.nix @@ -13,6 +13,7 @@ in dev.enable = true; pipewire.enable = true; print-and-scan.enable = true; + protonmail-bridge.enable = true; # keep-sorted end environment.systemPackages = with pkgs; [ diff --git a/modules/nixos/features/protonmail-bridge.nix b/modules/nixos/features/protonmail-bridge.nix new file mode 100644 index 0000000..2db8958 --- /dev/null +++ b/modules/nixos/features/protonmail-bridge.nix @@ -0,0 +1,17 @@ +{ + config, + lib, + ... +}: +let + feature = "protonmail-bridge"; +in +{ + config = lib.mkIf config.${feature}.enable { + services.protonmail-bridge.enable = true; + }; + + imports = [ ]; + + options.${feature}.enable = lib.mkEnableOption "enables ${feature}"; +}