feat: add personal email profile

This commit is contained in:
Moritz Böhme 2024-12-21 12:22:58 +01:00
parent d2a4ec7f03
commit 0ca1625a75
Signed by: moritz
GPG key ID: 970C6E89EB0547A9
3 changed files with 101 additions and 28 deletions

View file

@ -3,6 +3,7 @@
# and in the NixOS manual (accessible by running nixos-help). # and in the NixOS manual (accessible by running nixos-help).
{ pkgs { pkgs
, config , config
, inputs
, ... , ...
}: }:
@ -19,6 +20,7 @@
desktop.enable = true; desktop.enable = true;
gaming.enable = true; gaming.enable = true;
personal.enable = true; personal.enable = true;
personal.mail = true;
impermanence.enable = true; impermanence.enable = true;
webis.enable = true; webis.enable = true;
}; };

View file

@ -10,8 +10,7 @@ in
{ {
options.my.profiles.personal.enable = mkEnableOption "personal profile"; options.my.profiles.personal.enable = mkEnableOption "personal profile";
config = mkIf cfg.enable config = mkIf cfg.enable {
{
my = { my = {
services = { services = {
openconnect.enable = true; openconnect.enable = true;

View file

@ -0,0 +1,72 @@
{ lib
, config
, pkgs
, ...
}:
with lib;
let
cfg = config.my.profiles.personal;
filterHtml = pkgs.writeScript "filter_html" ''
${lib.getExe pkgs.w3m} -T text/html \
-cols $(tput cols) \
-dump \
-o display_image=false \
-o display_link_number=true "$@"
'';
in
{
options.my.profiles.personal.mail = mkEnableOption "personal email";
config = mkIf cfg.mail {
home-manager.users.moritz = {
home.packages = with pkgs; [
w3m
];
programs.aerc = {
enable = true;
extraConfig = {
general.unsafe-accounts-conf = true;
viewer = {
alternatives = "text/plain,text/html";
header-layout = "From,To,Cc,Bcc,Date,Subject";
};
filters = {
"text/html" = "${filterHtml}";
"text/plain" = "colorize";
"text/calendar" = "calendar";
"message/delivery-status" = "colorize";
"message/rfc822" = "colorize";
".headers" = "colorize";
};
};
};
services.mbsync.enable = true;
services.imapnotify.enable = true;
programs.mbsync.enable = true;
accounts.email.accounts.personal = {
imapnotify.enable = true;
imapnotify.boxes = [ "Inbox" ];
imapnotify.onNotify = "systemctl start --user mbsync.service";
primary = true;
address = "mail@moritzboeh.me";
userName = "mail@moritzboeh.me";
aerc.enable = true;
gpg.signByDefault = true;
gpg.key = "0xE4F362A3F5C338A0";
imap.host = "mail.your-server.de";
smtp.host = "mail.your-server.de";
realName = "Moritz Böhme";
mbsync.enable = true;
mbsync.create = "both";
passwordCommand = "cat /run/agenix/email";
};
accounts.email.maildirBasePath = "Documents/Mail";
};
age.secrets.email = {
file = ../../secrets/email.age;
owner = "1000";
};
};
}