Configure protonmail with mbsync and mu

This commit is contained in:
nathan mccarty 2022-07-02 16:15:19 -04:00
parent bace462b47
commit aadef397ac
Signed by: thatonelutenist
GPG Key ID: D70DA3DD4D1E9F96
6 changed files with 120 additions and 2 deletions

View File

@ -0,0 +1,22 @@
-----BEGIN CERTIFICATE-----
MIIDqzCCApOgAwIBAgIRAJ8hYGGIdDyn13K0d/euZzgwDQYJKoZIhvcNAQELBQAw
VzELMAkGA1UEBhMCQ0gxHzAdBgNVBAoTFlByb3RvbiBUZWNobm9sb2dpZXMgQUcx
EzARBgNVBAsTClByb3Rvbk1haWwxEjAQBgNVBAMTCTEyNy4wLjAuMTAeFw0yMjA2
MjgxMjM0MzRaFw00MjA2MjMxMjM0MzRaMFcxCzAJBgNVBAYTAkNIMR8wHQYDVQQK
ExZQcm90b24gVGVjaG5vbG9naWVzIEFHMRMwEQYDVQQLEwpQcm90b25NYWlsMRIw
EAYDVQQDEwkxMjcuMC4wLjEwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIB
AQDL1asnn8Z9Uvk8zT9hfdCG2MuHfSYSNi4/RNqzA0kACfCw8/fKQx+FDJOWuZAH
7ZJA8+xk3W+AS2VTb35+TtwWSyIE/9cc4exTSx52Mv/EdhrSCbIBPGmp6MPiLFCf
5xPD7Df6WbfGuTcfc6sBIUPcN9qZmud2tiHCb6CCvyWpTrLjaSCAx5eRB4mKlqiz
bFaTrEal/DSgrtziMRwawCLMH3Q7/6PQNTpXzOGXhrhy3b9Fi7aLLHztQWr23C9K
RI22TgawYh/rG7xd/tjSm7qJkhsqvFoq/41I4c/PMNTpVuCWYQyBr7pm9CxrvIsA
of6vbMScUT+h3pWl/cz1lNrhAgMBAAGjcjBwMA4GA1UdDwEB/wQEAwICpDAdBgNV
HSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDwYDVR0TAQH/BAUwAwEB/zAdBgNV
HQ4EFgQUwqc9Wvucag5zHRnlXw6Ti3kt3aAwDwYDVR0RBAgwBocEfwAAATANBgkq
hkiG9w0BAQsFAAOCAQEAp0YD/BlWvjE7PBMnpR4LOJO/RqxtUgaKMb1DiFCtrBai
n3MHJEVaZsFNk7Golm2ZihmfTFou60JFpt7FtspgQp8XzIA0oXnGqB+6EYFfmC8X
aJK1yrOI1R+nYCY99BGZ8BzyhwXh7ofNQt1+SzP7iBA1HwDy19HVQTRedt3rm61Q
WKudhxo8IIhWSTQ2OLYMSU1PrSdPjS+wUBY8rqrXz6xdHT5yxcwMyTURQJmF6GGl
dCVv5Q89hrvG26rv6ycldLMRbBlaAoNr8JCSbHPpU/KQybSsga0Qui7z0w7mYT4z
NJNXADYysmkqbNuj8pAGTzio64EFqQCDbkWOW7DlSQ==
-----END CERTIFICATE-----

View File

@ -72,7 +72,7 @@
sops-nix.nixosModules.sops
home-manager.nixosModules.home-manager
./modules/default.nix
({ pkgs, lib, ... }: {
({ pkgs, lib, config, ... }: {
# Configure hostname
networking = {
hostName = hostName;
@ -90,6 +90,7 @@
useGlobalPkgs = true;
extraSpecialArgs = {
inputs = inputs;
nixosConfig = config;
};
sharedModules = [
./home-manager/default.nix

View File

@ -11,7 +11,8 @@ with lib; with nLib; {
./programs/emacs.nix
./programs/image-editing.nix
./programs/media.nix
./programs/syncthing.nix
./services/syncthing.nix
./services/email.nix
];
options = {
@ -20,6 +21,12 @@ with lib; with nLib; {
services = {
# Synthing, enabled by default on linux desktop
syncthing = mkDefaultOption "Syncthing" (config.nathan.config.isDesktop && pkgs.stdenv.isLinux);
# Email syncing
# Disabled by default since this requires manual setup on the machine
# TODO: Get this working on darwin
email = {
enable = mkEnableOption "Email";
};
};
# Programs
programs = {

View File

@ -2,6 +2,11 @@
{
nathan = {
services = {
email = {
enable = true;
};
};
config = {
isDesktop = true;
};

View File

@ -0,0 +1,83 @@
{ config, nixosConfig, lib, pkgs, ... }:
with lib; {
config = mkIf config.nathan.services.email.enable {
# Packages used for mbsync + mu + protonmail-bridge
home.packages = with pkgs; [
pass
protonmail-bridge
mu
xapian
];
# Configure protonmail as a service
systemd.user.services.protonmail-bridge = {
Unit = {
Description = "Proton Mail Bridge";
After = [ "graphical-session-pre.target" ];
Before = [ "mbsync.service" ];
PartOf = [ "graphical-session.target" ];
};
Service = {
Type = "simple";
ExecStart = ''
${pkgs.protonmail-bridge}/bin/protonmail-bridge --noninteractive
'';
};
};
# Setup accounts
accounts.email = {
maildirBasePath = ".mail";
accounts = {
"nathan@mccarty.io" = {
maildir = {
path = "nathan@mccarty.io";
};
address = "nathan@mccarty.io";
primary = true;
realName = "Nathan McCarty";
userName = "nathan@mccarty.io";
# TODO: Move into `pass`
passwordCommand = "${pkgs.pass}/bin/pass protonmail-bridge-password";
aliases = [
"thatonelutenist@protonmail.com"
"nathan@asuran.rs"
"nathan@community.rs"
];
imap = {
host = "127.0.0.1";
port = 1143;
tls = {
useStartTls = true;
certificatesFile = ../../certificates/protonmail-${nixosConfig.networking.hostName}.pem;
};
};
smtp = {
host = "127.0.0.1";
port = 1025;
tls = {
useStartTls = true;
certificatesFile = ../../certificates/protonmail-${nixosConfig.networking.hostName}.pem;
};
};
mbsync = {
enable = true;
create = "maildir";
};
mu.enable = true;
};
};
};
# Setup mbsync
programs.mbsync = {
enable = true;
};
services.mbsync = {
enable = true;
postExec = "${pkgs.mu}/bin/mu index";
};
# Setup mu
programs.mu = {
enable = true;
};
};
}