about summary refs log tree commit diff
path: root/modules/common/emacs/default.nix
diff options
context:
space:
mode:
authorAzat Bahawi <azat@bahawi.net>2023-03-20 03:24:54 +0300
committerAzat Bahawi <azat@bahawi.net>2023-03-20 03:24:54 +0300
commit1ea1b781a142a41b72aed4bfc408233732034241 (patch)
treeff1124f7c52fdfcaa864e6866c22a7acf68f7c55 /modules/common/emacs/default.nix
parent2023-03-16 (diff)
2023-03-20
Diffstat (limited to '')
-rw-r--r--modules/common/emacs/default.nix41
1 files changed, 34 insertions, 7 deletions
diff --git a/modules/common/emacs/default.nix b/modules/common/emacs/default.nix
index 2dbe53f..c89fba5 100644
--- a/modules/common/emacs/default.nix
+++ b/modules/common/emacs/default.nix
@@ -69,7 +69,6 @@ in {
                   json-language-server # :lang (json +lsp)
                   libtool # :term vterm
                   nix-language-server # :lang (nix +lsp)
-                  nixfmt # :lang nix :editor format
                   nodePackages.eslint # :lang (json +lsp)
                   nodePackages.js-beautify # :lang web
                   nodePackages.prettier # :editor format
@@ -127,13 +126,11 @@ in {
               (appendq! auth-sources '("${config.secrets.authinfo.path}"))
 
               ;; Font must be set to N+2 because otherwise it looks too small.
-              (setq doom-font (font-spec :family "${config.fontScheme.monospaceFont.family}"
-                                          :size ${toString (config.fontScheme.monospaceFont.size + 2)})
+              (setq doom-font (font-spec
+                                :family "${config.fontScheme.monospaceFont.family}"
+                                :size ${toString (config.fontScheme.monospaceFont.size + 2)})
                     doom-unicode-font doom-font)
 
-              (setq user-full-name "${my.fullname}"
-                    user-mail-address "${my.email}")
-
               ;; :app irc
               (setq circe-default-nick "${my.username}"
                     circe-default-realname "${my.email}"
@@ -147,6 +144,36 @@ in {
 
               ;; :input japanese
               (setq skk-large-jisyo "${pkgs.skk-dicts}/share/skk/SKK-JISYO.L")
+
+              ;; :lang nix
+              (setq nix-nixfmt-bin "${pkgs.writeShellScript "nixfmt" ''
+                ${pkgs.alejandra}/bin/alejandra --quiet "$@"
+              ''}")
+            '')
+            (with config.hm.accounts.email; let
+              mu4eAccounts = let
+                muAccounts = filter (a: a.mu.enable) (attrValues accounts);
+              in
+                concatMapStringsSep "\n" (a:
+                  with a; let
+                    personalAddresses = concatMapStringsSep " " (v: ''"${v}"'') aliases;
+                  in ''
+                    (set-email-account! "${name}"
+                      '((user-full-name        . "${realName}")
+                        (user-mail-address     . "${address}")
+                        (mu4e-inbox-folder     . "/${name}/${folders.inbox}")
+                        (mu4e-sent-folder      . "/${name}/${folders.sent}")
+                        (mu4e-drafts-folder    . "/${name}/${folders.drafts}")
+                        (mu4e-trash-folder     . "/${name}/${folders.trash}")
+                        (mu4e-refile-folder    . "/${name}/Archive")
+                        (+mu4e-personal-addresses (list ${personalAddresses})))
+                      t)
+                  '')
+                muAccounts;
+            in ''
+              (setq mu4e-root-maildir "${maildirBasePath}")
+
+              ${mu4eAccounts}
             '')
             (builtins.readFile ./doom/config.el)
           ];
@@ -160,7 +187,7 @@ in {
             fi
 
             if [[ ! -d "$DOOMDIR" ]]; then
-              mkdir -p "$DOOMDIR"
+              mkdir -p "$DOOMDIR/snippets"
             fi
 
             if [[ -x "$EMACSDIR/bin/doom" ]]; then

Consider giving Nix/NixOS a try! <3