diff --git a/modules/desktop/apps/default.nix b/modules/desktop/apps/default.nix index d1f639b..7a810f5 100644 --- a/modules/desktop/apps/default.nix +++ b/modules/desktop/apps/default.nix @@ -1,7 +1,14 @@ { config, lib, pkgs, ... }: { - imports = [ ./rofi ./kitty.nix ./zathura.nix ./spotify.nix ./firefox.nix ]; + imports = [ + ./email.nix + ./firefox.nix + ./kitty.nix + ./rofi + ./spotify.nix + ./zathura.nix + ]; home-manager.users.moritz = { services.nextcloud-client = { enable = true; diff --git a/modules/desktop/apps/email.nix b/modules/desktop/apps/email.nix index 77eacf2..3233b5d 100644 --- a/modules/desktop/apps/email.nix +++ b/modules/desktop/apps/email.nix @@ -1,7 +1,9 @@ { config, lib, pkgs, ... }: - -{ - home-manager.users.moritz = { home.packages = with pkgs; [ thunderbird ]; }; +let + name = "Moritz Böhme"; + email = "mail@moritzboeh.me"; + mailDirectory = "/home/moritz/.mail"; +in { environment.systemPackages = with pkgs; [ protonmail-bridge ]; systemd.user.services.protonmail-bridge = { description = "Protonmail Bridge"; @@ -14,5 +16,63 @@ wantedBy = [ "graphical-session.target" ]; partOf = [ "graphical-session.target" ]; }; + home-manager.users.moritz = { + home = { packages = with pkgs; [ thunderbird ]; }; + programs = { + msmtp.enable = true; + mbsync.enable = true; + }; + + services = { + mbsync = { + enable = true; + frequency = "*:0/15"; + preExec = "${pkgs.isync}/bin/mbsync -Ha"; + postExec = "${pkgs.mu}/bin/mu index -m ${mailDirectory}"; + }; + }; + + accounts.email = { + maildirBasePath = mailDirectory; + accounts = { + default = { + address = email; + userName = email; + flavor = "plain"; + primary = true; + passwordCommand = "${pkgs.coreutils}/bin/cat /run/agenix/email"; + mbsync = { + enable = true; + create = "both"; + expunge = "both"; + patterns = [ "*" ]; + }; + realName = name; + msmtp.enable = true; + mu.enable = true; + imap = { + host = "127.0.0.1"; + port = 1143; + tls = { + enable = true; + useStartTls = true; + certificatesFile = + "/home/moritz/.config/protonmail/bridge/cert.pem"; + }; + }; + smtp = { + host = "127.0.0.1"; + port = 1025; + tls = { + enable = true; + useStartTls = true; + certificatesFile = + "/home/moritz/.config/protonmail/bridge/cert.pem"; + }; + }; + }; + }; + }; + }; networking.firewall.allowedTCPPorts = [ 33728 1025 1143 ]; } diff --git a/modules/editors/emacs.nix b/modules/editors/emacs.nix index b72db1c..a6faad5 100644 --- a/modules/editors/emacs.nix +++ b/modules/editors/emacs.nix @@ -9,8 +9,10 @@ in { home-manager.users.moritz = { home.sessionPath = [ "/home/moritz/.config/emacs/bin/" ]; - services.emacs.enable = true; - services.emacs.package = emacs; + services.emacs = { + enable = true; + package = emacs; + }; home.packages = with pkgs; [ ## Emacs itself @@ -60,6 +62,10 @@ in { # :lang python python-language-server + + # :email + mu + isync ]; }; } diff --git a/modules/services/agenix.nix b/modules/services/agenix.nix index 93bdb5b..303d565 100644 --- a/modules/services/agenix.nix +++ b/modules/services/agenix.nix @@ -18,5 +18,9 @@ file = ../../secrets/spotifyd.age; owner = "1000"; }; + email = { + file = ../../secrets/email.age; + owner = "1000"; + }; }; } diff --git a/secrets/email.age b/secrets/email.age new file mode 100644 index 0000000..016684f --- /dev/null +++ b/secrets/email.age @@ -0,0 +1,12 @@ +age-encryption.org/v1 +-> ssh-ed25519 ZYd7Zg wvi/2k5o+KRHR6Xzm5wgin2yufYKjjGSHYlEBCTc/y8 +US5D1br8ojykueREHJFNgcf7JMtmqVfrN+Sa1Vge4k0 +-> ssh-ed25519 wG6LYg /7dm5XhaIPvsDu55tvdUHc9tbH3k7wYSYWffduDPNSA +wBXBMF/u4F6yHBQAyCl/W4k36hxsLbP1Fc+gRp4nJYs +-> ssh-ed25519 CjuqfA vYcPVSphrt9ghQG0ylLBl8QEcKvbuigpUJtm3iUlLy8 +Ehy0HPXinGoQGVy/+jHnLc4ese1W7hZg0J4+gEk5bbM +-> &yBeH5&%-grease fDn]Xtb | $&y&-) +EsEgMhctNxnM5Ri7rK44QGowx1+0ueL74CvmgkoGzvPlWEVTKYxWo3qGt/TV2d6X +X9ieZg8jOqcdAXzwjiWy9aiXp8BklMeKCHo1 +--- wLPAD09HngB9TizcPxqYUmnGMVdk9EX6MCcU0yjJ+Os +0! <Amq{=O/λfݢ2Y2UG \ No newline at end of file diff --git a/secrets/secrets.nix b/secrets/secrets.nix index 06b32d0..986e113 100644 --- a/secrets/secrets.nix +++ b/secrets/secrets.nix @@ -8,11 +8,11 @@ let nixos-desktop = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKl8gMhwSf1NsP5gp14xbbyjqQLZzcHLb/XKRMoHdXgI"; hosts = [ nixos-laptop nixos-desktop ]; -in -{ +in { "nordvpn.age".publicKeys = users ++ hosts; "davfs.age".publicKeys = users ++ hosts; "smbMoritz.age".publicKeys = users ++ hosts; "smbMedia.age".publicKeys = users ++ hosts; "spotifyd.age".publicKeys = users ++ hosts; + "email.age".publicKeys = users ++ hosts; }