about summary refs log tree commit diff
path: root/modules/common/emacs
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
parent2023-03-16 (diff)
2023-03-20
Diffstat (limited to 'modules/common/emacs')
-rw-r--r--modules/common/emacs/default.nix41
-rw-r--r--modules/common/emacs/doom/config.el70
-rw-r--r--modules/common/emacs/doom/packages.el6
3 files changed, 59 insertions, 58 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
diff --git a/modules/common/emacs/doom/config.el b/modules/common/emacs/doom/config.el
index 502ca27..4863792 100644
--- a/modules/common/emacs/doom/config.el
+++ b/modules/common/emacs/doom/config.el
@@ -84,8 +84,6 @@
 ;;; Nix
 ;;
 
-(setq nix-nixfmt-bin "alejandra")
-
 (after! lsp-mode
   (add-to-list 'lsp-language-id-configuration '(nix-mode . "nix"))
   (lsp-register-client
@@ -100,9 +98,9 @@
 (add-hook! 'yaml-mode-hook
   (defun +disable-flycheck-for-yaml-helm-templates ()
     (when (and buffer-file-name
-              (string-match-p "/templates/" buffer-file-name)
-              (or (string-suffix-p ".yaml" buffer-file-name)
-                  (string-suffix-p ".yml" buffer-file-name)))
+               (string-match-p "/templates/" buffer-file-name)
+               (or (string-suffix-p ".yaml" buffer-file-name)
+                   (string-suffix-p ".yml" buffer-file-name)))
       (remove-hook! 'yaml-mode-local-vars-hook #'lsp!)
       (pushnew! flycheck-disabled-checkers 'yaml-jsyaml 'yaml-ruby 'yaml-yamllint))))
 
@@ -126,66 +124,42 @@
 (setq mu4e-root-maildir "~/mail"
       mu4e-context-policy 'ask-if-none
       mu4e-compose-context-policy 'always-ask
-      mu4e-compose--org-msg-toggle-next nil
       mu4e-update-interval 60
       sendmail-program (executable-find "msmtp")
-      send-mail-function #'smtpmail-send-it
-      message-sendmail-f-is-evil t
-      message-sendmail-extra-arguments '("--read-envelope-from")
+      send-mail-function #'message-send-mail-with-sendmail
       message-send-mail-function #'message-send-mail-with-sendmail
-      +mu4e-personal-addresses (list "frodo@gondor.net"
-                                     "frodo@rohan.net"
-                                     "azahi@shire.me"
-                                     "admin@shire.me"
-                                     "ceo@shire.me"
-                                     "a.gondor@yahoo.com"
-                                     "a.gondor@yahoo.com"))
-
-(set-email-account! "shire"
-                    '((mu4e-drafts-folder . "/shire/Drafts")
-                      (mu4e-refile-folder . "/shire/Archive")
-                      (mu4e-sent-folder   . "/shire/Sent")
-                      (mu4e-trash-folder  . "/shire/Trash")
-                      (smtpmail-smtp-user . "azahi"))
-                    t)
-
-(set-email-account! "yahoo"
-                    '((mu4e-sent-folder   . "/yahoo/Sent")
-                      (mu4e-drafts-folder . "/yahoo/Drafts")
-                      (mu4e-trash-folder  . "/yahoo/Trash")
-                      (mu4e-refile-folder . "/yahoo/Archive")
-                      (smtpmail-smtp-user . "a.gondor"))
-                    t)
-
-(setq +mu4e-compose-org-msg-toggle-next nil)
+      message-sendmail-envelope-from 'header
+      message-sendmail-extra-arguments '("--read-envelope-from")
+      message-sendmail-f-is-evil t
+      message-kill-buffer-on-exit t)
 
 ;;
 ;;; Circe
 ;;
 
 (defun nixfiles/irc-bouncer-password-f (&rest _)
-  (+pass-get-secret "server/soju.manwe.shire.me/azahi"))
+  (+pass-get-secret "server/soju.manwe.shire.net/azahi"))
 
 (set-irc-server! "libera"
-  `(:host "shire.me"
+  `(:host "shire.net"
     :port 6667
     :user "azahi/libera"
     :pass nixfiles/irc-bouncer-password-f))
 
 (set-irc-server! "oftc"
-  `(:host "shire.me"
+  `(:host "shire.net"
     :port 6667
     :user "azahi/oftc"
     :pass nixfiles/irc-bouncer-password-f))
 
 (set-irc-server! "hackint"
-  `(:host "shire.me"
+  `(:host "shire.net"
     :port 6667
     :user "azahi/hackint"
     :pass nixfiles/irc-bouncer-password-f))
 
 (set-irc-server! "rizon"
-  `(:host "shire.me"
+  `(:host "shire.net"
     :port 6667
     :user "azahi/rizon"
     :pass nixfiles/irc-bouncer-password-f))
@@ -212,14 +186,14 @@
 ;;   :init
 ;;   (setq hledger-input-buffer-height 20))
 
-;; (use-package! kubernetes
-;;   :defer t
-;;   :commands (kubernetes-overview)
-;;   :init (setq kubernetes-poll-frequency 3600
-;;               kubernetes-redraw-frequency 3600))
+(use-package! kubernetes
+  :defer t
+  :commands (kubernetes-overview)
+  :init (setq kubernetes-poll-frequency 3600
+              kubernetes-redraw-frequency 3600))
 
-;; (use-package! kubernetes-evil
-;;   :after kubernetes-overview)
+(use-package! kubernetes-evil
+  :after kubernetes-overview)
 
-;; (use-package! kubernetes-tramp
-;;   :defer t)
+(use-package! kubernetes-tramp
+  :defer t)
diff --git a/modules/common/emacs/doom/packages.el b/modules/common/emacs/doom/packages.el
index 298a203..5df21b6 100644
--- a/modules/common/emacs/doom/packages.el
+++ b/modules/common/emacs/doom/packages.el
@@ -12,6 +12,6 @@
 
 ;; (package! hledger-mode)
 
-;; (package! kubernetes)
-;; (package! kubernetes-evil)
-;; (package! kubernetes-tramp)
+(package! kubernetes)
+(package! kubernetes-evil)
+(package! kubernetes-tramp)

Consider giving Nix/NixOS a try! <3