From 0ca1625a755631f95d7f34bed39483201534cfa2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20B=C3=B6hme?= Date: Sat, 21 Dec 2024 12:22:58 +0100 Subject: [PATCH] feat: add personal email profile --- hosts/nixos-desktop/default.nix | 2 + modules/profiles/personal.nix | 55 +++++++++++------------ modules/profiles/personal_mail.nix | 72 ++++++++++++++++++++++++++++++ 3 files changed, 101 insertions(+), 28 deletions(-) create mode 100644 modules/profiles/personal_mail.nix diff --git a/hosts/nixos-desktop/default.nix b/hosts/nixos-desktop/default.nix index 311468c..d850215 100644 --- a/hosts/nixos-desktop/default.nix +++ b/hosts/nixos-desktop/default.nix @@ -3,6 +3,7 @@ # and in the NixOS manual (accessible by running ‘nixos-help’). { pkgs , config +, inputs , ... }: @@ -19,6 +20,7 @@ desktop.enable = true; gaming.enable = true; personal.enable = true; + personal.mail = true; impermanence.enable = true; webis.enable = true; }; diff --git a/modules/profiles/personal.nix b/modules/profiles/personal.nix index 58c2485..887bae6 100644 --- a/modules/profiles/personal.nix +++ b/modules/profiles/personal.nix @@ -10,40 +10,39 @@ in { options.my.profiles.personal.enable = mkEnableOption "personal profile"; - config = mkIf cfg.enable - { - my = { - services = { - openconnect.enable = true; - synology-drive.enable = true; - }; - programs = { - ssh.includeSecrets = [ ../../secrets/ssh-home.age ]; - git.signing = mkDefault true; - hub.enable = mkDefault true; - firefox.arkenfox = { - enable = mkDefault true; - overrides = mkDefault { - ## arkenfox overrides - # automatic search - "keyword.enabled" = true; - "browser.search.suggest.enabled" = true; - "browser.urlbar.suggest.searches" = true; + config = mkIf cfg.enable { + my = { + services = { + openconnect.enable = true; + synology-drive.enable = true; + }; + programs = { + ssh.includeSecrets = [ ../../secrets/ssh-home.age ]; + git.signing = mkDefault true; + hub.enable = mkDefault true; + firefox.arkenfox = { + enable = mkDefault true; + overrides = mkDefault { + ## arkenfox overrides + # automatic search + "keyword.enabled" = true; + "browser.search.suggest.enabled" = true; + "browser.urlbar.suggest.searches" = true; - # Restore previous session on startup - "browser.startup.page" = 3; + # Restore previous session on startup + "browser.startup.page" = 3; - # drm - "media.eme.enabled" = true; + # drm + "media.eme.enabled" = true; - # sanitisation - "privacy.clearOnShutdown.history" = false; + # sanitisation + "privacy.clearOnShutdown.history" = false; - # disable letterboxing - "privacy.resistFingerprinting.letterboxing" = false; - }; + # disable letterboxing + "privacy.resistFingerprinting.letterboxing" = false; }; }; }; }; + }; } diff --git a/modules/profiles/personal_mail.nix b/modules/profiles/personal_mail.nix new file mode 100644 index 0000000..9f80231 --- /dev/null +++ b/modules/profiles/personal_mail.nix @@ -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"; + }; + }; +}