about summary refs log tree commit diff
path: root/modules/common/profiles
diff options
context:
space:
mode:
Diffstat (limited to 'modules/common/profiles')
-rw-r--r--modules/common/profiles/default.nix1
-rw-r--r--modules/common/profiles/email.nix89
-rw-r--r--modules/common/profiles/headful.nix76
3 files changed, 91 insertions, 75 deletions
diff --git a/modules/common/profiles/default.nix b/modules/common/profiles/default.nix
index 06ddaf4..4f8fa4d 100644
--- a/modules/common/profiles/default.nix
+++ b/modules/common/profiles/default.nix
@@ -10,6 +10,7 @@ with lib; let
 in {
   imports = [
     ./dev
+    ./email.nix
     ./headful.nix
     ./headless.nix
     (mkAliasOptionModule ["colourScheme"] [
diff --git a/modules/common/profiles/email.nix b/modules/common/profiles/email.nix
new file mode 100644
index 0000000..e289c2e
--- /dev/null
+++ b/modules/common/profiles/email.nix
@@ -0,0 +1,89 @@
+{
+  config,
+  lib,
+  pkgs,
+  this,
+  ...
+}:
+with lib; let
+  cfg = config.nixfiles.modules.profiles.email.default;
+in {
+  options.nixfiles.modules.profiles.email.default.enable =
+    mkEnableOption "Local Email management" // {default = this.isHeadful;};
+
+  config = mkIf cfg.enable {
+    hm = {
+      accounts.email = {
+        maildirBasePath = "${config.my.home}/doc/mail";
+
+        accounts = let
+          mkAccount = attrs:
+            mkMerge [
+              {
+                mbsync = {
+                  enable = true;
+                  create = "both";
+                  expunge = "both";
+                  patterns = ["*"];
+                };
+                msmtp.enable = true;
+                mu.enable = true;
+                thunderbird = {
+                  enable = pkgs.stdenv.isLinux;
+                  settings = id: {
+                    "mail.identity.id_${id}.compose_html" = false;
+                    "mail.identity.id_${id}.reply_on_top" = 0;
+                  };
+                };
+              }
+              attrs
+            ];
+
+          pass = path: "${config.hm.programs.password-store.package}/bin/pass show ${path}";
+        in rec {
+          shire = mkAccount rec {
+            address = my.email;
+            aliases = [address "frodo@rohan.net" "azahi@shire.net"];
+            realName = my.fullname;
+            gpg = {
+              inherit (my.pgp) key;
+              signByDefault = true;
+              encryptByDefault = false;
+            };
+
+            primary = true;
+
+            imap = {
+              host = "shire.net";
+              port = 993;
+              tls.enable = true;
+            };
+            smtp = {
+              host = "shire.net";
+              port = 465;
+              tls.enable = true;
+            };
+            userName = "azahi@shire.net";
+            passwordCommand = pass "email/shire.net/azahi";
+          };
+
+          yahoo = mkAccount rec {
+            address = "admin@yahoo.com";
+            aliases = [address "admin@yahoo.com"];
+            realName = "Багавиев Азат";
+
+            flavor = "yahoo.com";
+            userName = "admin@yahoo.com";
+            passwordCommand = pass "email/yahoo.com/admin";
+          };
+        };
+      };
+
+      programs = {
+        mbsync.enable = true;
+        msmtp.enable = true;
+        mu.enable = true;
+      };
+    };
+  };
+}
diff --git a/modules/common/profiles/headful.nix b/modules/common/profiles/headful.nix
index ea36b91..2be1b87 100644
--- a/modules/common/profiles/headful.nix
+++ b/modules/common/profiles/headful.nix
@@ -19,6 +19,7 @@ in {
       aria2.enable = true;
       emacs.enable = true;
       mpv.enable = true;
+      nullmailer.enable = true;
       openssh.client.enable = true;
       password-store.enable = true;
     };
@@ -33,85 +34,10 @@ in {
 
         packages = with pkgs; [
           fd
-          logcli
           ripgrep
           ripgrep-all
           sd
         ];
-
-        sessionVariables.LOKI_ADDR = "https://loki.shire.net";
-      };
-
-      accounts.email = {
-        maildirBasePath = "${config.my.home}/mail";
-
-        accounts = let
-          mkAccount = attrs:
-            mkMerge [
-              {
-                mbsync = {
-                  enable = true;
-                  create = "both";
-                  expunge = "both";
-                  patterns = ["*"];
-                };
-                msmtp.enable = true;
-                mu.enable = true;
-                thunderbird = {
-                  enable = pkgs.stdenv.isLinux;
-                  settings = id: {
-                    "mail.identity.id_${id}.compose_html" = false;
-                    "mail.identity.id_${id}.reply_on_top" = 0;
-                  };
-                };
-              }
-              attrs
-            ];
-
-          pass = path: "${config.hm.programs.password-store.package}/bin/pass show ${path}";
-        in rec {
-          shire = mkAccount rec {
-            address = my.email;
-            aliases = [address "frodo@rohan.net" "azahi@shire.net"];
-            realName = my.fullname;
-            gpg = {
-              inherit (my.pgp) key;
-              signByDefault = true;
-              encryptByDefault = false;
-            };
-
-            primary = true;
-
-            imap = {
-              host = "shire.net";
-              port = 993;
-              tls.enable = true;
-            };
-            smtp = {
-              host = "shire.net";
-              port = 465;
-              tls.enable = true;
-            };
-            userName = "azahi@shire.net";
-            passwordCommand = pass "email/shire.net/azahi";
-          };
-
-          yahoo = mkAccount rec {
-            address = "admin@yahoo.com";
-            aliases = [address "admin@yahoo.com"];
-            realName = "Багавиев Азат";
-
-            flavor = "yahoo.com";
-            userName = "admin@yahoo.com";
-            passwordCommand = pass "email/yahoo.com/admin";
-          };
-        };
-      };
-
-      programs = {
-        mbsync.enable = true;
-        msmtp.enable = true;
-        mu.enable = true;
       };
     };
 

Consider giving Nix/NixOS a try! <3