Commit 9221d41b100a

Vincent Demeester <vincent@sbr.pm>
2019-02-22 20:08:08
modules: add email module
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
1 parent ce4684c
Changed files (2)
modules/profiles/mails.nix
@@ -0,0 +1,74 @@
+{ config, lib, ... }:
+
+with lib;
+let
+  cfg = config.profiles.mails;
+in
+{
+  options = {
+    profiles.mails = {
+      enable = mkOption {
+        default = true;
+        description = "Enable mails configurations";
+        type = types.bool;
+      };
+    };
+  };
+  config = mkIf cfg.enable {
+    accounts.email = {
+      maildirBasePath = "desktop/mails";
+      accounts = {
+        "redhat" = {
+          address = "vdemeest@redhat.com";
+          userName = "vdemeest@redhat.com";
+          realName = "Vincent Demeester";
+          passwordCommand = "gpg -q --for-your-eyes-only --no-tty --exit-on-status-write-error --batch --passphrase-file ~/sync/rh.pass -d ~/desktop/documents/rh.pass.gpg";
+          imap.host = "imap.gmail.com";
+          smtp.host = "smtp.gmail.com";
+          mbsync = {
+            enable = true;
+            create = "both";
+            #expunge = "both";
+            patterns = ["*" "![Gmail]*" "[Gmail]/Sent Mail" "[Gmail]/Starred" "[Gmail]/All Mail"];
+            extraConfig = {
+              channel = {
+                Sync = "All";
+              };
+            };
+          };
+          notmuch.enable = true;
+          astroid.enable = true;
+          msmtp.enable = true;
+        };
+        "perso" = {
+          primary = true;
+          address = "vinc.demeester@gmail.com";
+          userName = "vinc.demeester@gmail.com";
+          realName = "Vincent Demeester";
+          passwordCommand = "gpg -q --for-your-eyes-only --no-tty --exit-on-status-write-error --batch --passphrase-file ~/sync/perso.pass -d ~/desktop/documents/perso.pass.gpg";
+          imap.host = "imap.gmail.com";
+          smtp.host = "smtp.gmail.com";
+          mbsync = {
+            enable = true;
+            create = "both";
+            #expunge = "both";
+            patterns = ["*" "![Gmail]*" "[Gmail]/Sent Mail" "[Gmail]/Starred" "[Gmail]/All Mail"];
+            extraConfig = {
+              channel = {
+                Sync = "All";
+              };
+            };
+          };
+          notmuch.enable = true;
+          astroid.enable = true;
+          msmtp.enable = true;
+        };
+      };
+    };
+    services.mbsync.enable = true;
+    programs.mbsync.enable = true;
+    programs.afew.enable = true;
+    programs.notmuch.enable = true;
+    programs.msmtp.enable = true;
+  };
+}
modules/module-list.nix
@@ -20,6 +20,7 @@
     ./profiles/i3.nix
     ./profiles/kubernetes.nix
     ./profiles/laptop.nix
+    ./profiles/mails.nix
     ./profiles/media.nix
     ./profiles/openshift.nix
     ./profiles/ssh.nix