about summary refs log tree commit diff
path: root/modules
diff options
context:
space:
mode:
authorAzat Bahawi <azat@bahawi.net>2022-08-16 02:01:55 +0300
committerAzat Bahawi <azat@bahawi.net>2022-08-16 02:01:55 +0300
commit7a1a900334653e7cadfd60e1c92c128bf9c5a951 (patch)
tree8d90976f82f816fad2b0cf8a6e995368f8f80580 /modules
parent2022-08-15 (diff)
2022-08-16
Diffstat (limited to '')
-rw-r--r--modules/nixfiles/default.nix2
-rw-r--r--modules/nixfiles/emacs/default.nix (renamed from modules/nixfiles/emacs.nix)26
-rw-r--r--modules/nixfiles/emacs/doom/config.el183
-rw-r--r--modules/nixfiles/emacs/doom/custom.el0
-rw-r--r--modules/nixfiles/emacs/doom/init.el134
-rw-r--r--modules/nixfiles/emacs/doom/packages.el23
6 files changed, 360 insertions, 8 deletions
diff --git a/modules/nixfiles/default.nix b/modules/nixfiles/default.nix
index 8d26e7f..8632833 100644
--- a/modules/nixfiles/default.nix
+++ b/modules/nixfiles/default.nix
@@ -15,7 +15,7 @@
     ./direnv.nix
     ./docker.nix
     ./dwm.nix
-    ./emacs.nix
+    ./emacs
     ./endlessh-go.nix
     ./endlessh.nix
     ./fail2ban.nix
diff --git a/modules/nixfiles/emacs.nix b/modules/nixfiles/emacs/default.nix
index 230b965..3ebab5f 100644
--- a/modules/nixfiles/emacs.nix
+++ b/modules/nixfiles/emacs/default.nix
@@ -1,5 +1,6 @@
 {
   config,
+  inputs,
   lib,
   pkgs,
   ...
@@ -13,6 +14,10 @@ in {
   # TODO Nixify.
   config = mkIf cfg.enable {
     hm = {
+      imports = [
+        inputs.nix-doom-emacs.hmModule
+      ];
+
       home = {
         packages = with pkgs; [
           cmigemo # :lang japanese
@@ -49,13 +54,20 @@ in {
         };
       };
 
-      programs.emacs = {
-        enable = true;
-        package = pkgs.emacs28.override {nativeComp = true;};
-        extraPackages = p:
-          with p; [
-            vterm # :term vterm
-          ];
+      programs = {
+        emacs = {
+          enable = true;
+          # extraPackages = p:
+          #   with p; [
+          #     vterm # :term vterm
+          #   ];
+        };
+
+        doom-emacs = {
+          enable = true;
+          doomPrivateDir = ./doom;
+          emacsPackage = pkgs.emacs28.override {nativeComp = true;};
+        };
       };
 
       services.emacs = {
diff --git a/modules/nixfiles/emacs/doom/config.el b/modules/nixfiles/emacs/doom/config.el
new file mode 100644
index 0000000..d641e2d
--- /dev/null
+++ b/modules/nixfiles/emacs/doom/config.el
@@ -0,0 +1,183 @@
+;;; config.el -*- lexical-binding: t; -*-
+
+(setq user-full-name "Azat Bahawi"
+      user-mail-address "frodo@gondor.net")
+
+(setq doom-theme 'doom-tomorrow-night)
+
+(setq doom-font (font-spec
+                 :family "Iosevka"
+                 :size 18))
+
+(setq frame-title-format '("Emacs")
+      icon-title-format frame-title-format)
+
+(setq org-directory "~/doc/org/"
+      org-roam-directory "~/doc/roam/"
+      org-roam-db-location (concat org-roam-directory ".db"))
+(setq deft-directory org-directory
+      deft-default-extension "org")
+
+(use-package! websocket
+  :after org-roam)
+
+(use-package! org-roam-ui
+  :after org-roam
+  :config
+  (setq org-roam-ui-sync-theme t
+        org-roam-ui-follow t
+        org-roam-ui-update-on-save t
+        org-roam-ui-open-on-start t))
+
+(setq org-plantuml-jar-path "~/.local/share/plantuml/plantuml.jar")
+
+(setq migemo-dictionary "~/.local/share/migemo/utf-8/migemo-dict")
+
+(setq skk-large-jisyo "~/.local/share/skk/SKK-JISYO.L")
+
+(setq lsp-haskell-formatting-provider "brittany")
+
+(after! lsp-mode
+  (add-to-list 'lsp-language-id-configuration '(nix-mode . "nix"))
+  (lsp-register-client
+   (make-lsp-client :new-connection (lsp-stdio-connection '("rnix-lsp"))
+                    :major-modes '(nix-mode)
+                    :server-id 'nix))
+  (add-hook 'nix-mode-hook #'lsp!))
+
+(setq-hook! 'yaml-mode-hook +format-with-lsp nil)
+
+(setq +format-on-save-enabled-modes
+      '(not yaml-mode nix-mode))
+
+(add-hook 'org-mode-hook
+          (lambda (&rest _)
+            (setq fill-column 80)))
+(add-hook 'org-mode-hook 'auto-fill-mode)
+
+(add-hook 'org-mode-hook
+          (lambda (&rest _)
+            (electric-indent-local-mode -1)))
+
+;; TODO This directory will be synced with Syncthing to persist database across
+;; all machies. This is an attempt to mimic the guide from the link below
+;; http://babbagefiles.blogspot.com/2017/03/take-elfeed-everywhere-mobile-rss.html
+(setq elfeed-db-directory "~/.elfeed"
+      elfeed-enclosure-default-dir (concat elfeed-db-directory "/enclosures")
+      rmh-elfeed-org-files (list (concat elfeed-db-directory "/index.org"))
+      elfeed-goodies/powerline-default-separator nil
+      elfeed-goodies/entry-pane-size 0.75
+      elfeed-goodies/entry-pane-position 'bottom)
+
+(setq display-line-numbers-type t)
+
+(when (eq initial-window-system 'x)
+  (toggle-frame-maximized)
+  (toggle-frame-fullscreen))
+
+(setq browse-url-generic-program (executable-find "firefox")
+      browse-url-browser-function 'browse-url-generic)
+
+(setq mu4e-root-maildir "~/mail"
+      mu4e-context-policy 'ask-if-none
+      mu4e-compose-context-policy 'always-ask
+      mu4e-compose--org-msg-toggle-next nil
+      sendmail-program (executable-find "msmtp")
+      send-mail-function #'smtpmail-send-it
+      message-sendmail-f-is-evil t
+      message-sendmail-extra-arguments '("--read-envelope-from")
+      message-send-mail-function #'message-send-mail-with-sendmail
+      +mu4e-personal-addresses (list "frodo@gondor.net"
+                                     "frodo@rohan.net"
+                                     "azahi@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 circe-default-nick "azahi"
+      circe-default-realname "frodo@gondor.net"
+      circe-default-user circe-default-nick)
+
+(set-irc-server! "libera"
+  `(
+    :host "shire.me"
+    :port 6667
+    :user "azahi/libera"
+    :pass (lambda (&rest _)
+            (+pass-get-secret "server/soju.manwe.shire.me/azahi"))))
+
+(set-irc-server! "oftc"
+  `(
+    :host "shire.me"
+    :port 6667
+    :user "azahi/oftc"
+    :pass (lambda (&rest _)
+            (+pass-get-secret "server/soju.manwe.shire.me/azahi"))))
+
+(set-irc-server! "rizon"
+  `(
+    :host "shire.me"
+    :port 6667
+    :user "azahi/rizon"
+    :pass (lambda (&rest _)
+            (+pass-get-secret "server/soju.manwe.shire.me/azahi"))))
+
+(use-package! hledger-mode
+  :mode ("\\.journal\\'")
+  :hook ((hledger-view-mode . hl-line-mode)
+         (hledger-view-mode . center-text-for-reading))
+  :init
+  (setq hledger-jfile "~/doc/accounting/current.journal")
+  :config
+  (set-company-backend! 'hledger-mode
+    'hledger-company)
+
+  (add-hook 'hledger-mode-hook
+            (lambda (&rest _)
+              (make-local-variable 'company-backends)
+              (add-to-list 'company-backends 'hledger-company))))
+
+(use-package! hledger-input
+  :hook ((hledger-input-post-commit . hledger-show-new-balances)
+         (hledger-input-mode . auto-fill-mode)
+         (hledger-input-mode . (lambda (&rest _)
+                                 (make-local-variable 'compay-idle-delay)
+                                 (setq-local company-idle-delay 0.1))))
+  :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-evil
+  :after kubernetes-overview)
+
+(use-package! kubernetes-tramp
+  :defer t)
+
+(use-package! elpher
+  :init (setq elpher-default-url-type "gemini"))
+
+(provide 'config)
+;;; config.el ends here
diff --git a/modules/nixfiles/emacs/doom/custom.el b/modules/nixfiles/emacs/doom/custom.el
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/modules/nixfiles/emacs/doom/custom.el
diff --git a/modules/nixfiles/emacs/doom/init.el b/modules/nixfiles/emacs/doom/init.el
new file mode 100644
index 0000000..486010a
--- /dev/null
+++ b/modules/nixfiles/emacs/doom/init.el
@@ -0,0 +1,134 @@
+;;; init.el -*- lexical-binding: t; -*-
+
+(doom!
+  :input
+  japanese
+
+  :completion
+  company
+  vertico
+
+  :ui
+  deft
+  doom
+  ;; doom-dashboard
+  ;; doom-quit
+  ;; (emoji +unicode)
+  hl-todo
+  hydra
+  indent-guides
+  ;; ligatures
+  ;; (modeline +light)
+  nav-flash
+  ophints
+  (popup +defaults)
+  ;; tabs
+  ;; treemacs
+  unicode
+  vc-gutter
+  vi-tilde-fringe
+  window-select
+  workspaces
+  zen
+
+  :editor
+  (evil +everywhere)
+  file-templates
+  fold
+  (format +onsave)
+  lispy
+  multiple-cursors
+  (objed +manual)
+  parinfer
+  rotate-text
+  snippets
+  word-wrap
+
+  :emacs
+  dired
+  electric
+  ibuffer
+  (undo +tree)
+  vc
+
+  :term
+  eshell
+  vterm
+
+  :checkers
+  syntax
+  (spell +flyspell)
+  grammar
+
+  :tools
+  ansible
+  debugger
+  direnv
+  (docker +lsp)
+  editorconfig
+  (eval +overlay)
+  (lookup +dictionary +offline)
+  (lsp +peek)
+  magit
+  make
+  (pass +auth)
+  pdf
+  ;; rgb
+  ;; taskrunner
+  terraform
+  tmux
+  upload
+
+  :os
+  (tty +osc)
+
+  :lang
+  (cc +lsp)
+  common-lisp
+  ;; (csharp +lsp)
+  data
+  dhall
+  emacs-lisp
+  (go +lsp)
+  (haskell +lsp)
+  ;; (java +lsp)
+  ;; (javascript +lsp)
+  (json +lsp)
+  (latex +lsp)
+  ;; (lua +lsp)
+  markdown
+  nix
+  (org
+    +brain
+    +dragndrop
+    +gnuplot
+    +hugo
+    +journal
+    +noter
+    +pandoc
+    +pomodoro
+    +present
+    +roam2)
+  plantuml
+  ;; (php +lsp)
+  (python +lsp)
+  (racket +lsp)
+  ;; (rust +lsp)
+  (scheme +racket)
+  (sh +lsp)
+  web
+  (yaml +lsp)
+  (zig +lsp)
+
+  :email
+  mu4e
+
+  :app
+  calendar
+  emms
+  everywhere
+  irc
+  (rss +org)
+
+  :config
+  (default +bindings +smartparens))
diff --git a/modules/nixfiles/emacs/doom/packages.el b/modules/nixfiles/emacs/doom/packages.el
new file mode 100644
index 0000000..72c3945
--- /dev/null
+++ b/modules/nixfiles/emacs/doom/packages.el
@@ -0,0 +1,23 @@
+;;; packages.el -*- no-byte-compile: t; -*-
+
+(package! hledger-mode)
+
+(package! kubernetes)
+(package! kubernetes-evil)
+(package! kubernetes-tramp)
+
+(package! elpher)
+
+(unpin! org-roam)
+(package! org-roam
+  :recipe (:host github
+           :repo "org-roam/org-roam"
+           :branch "main"
+           :files (:defaults "extensions/*")))
+(package! org-roam-ui
+  :recipe (:host github
+           :repo "org-roam/org-roam-ui"
+           :branch "main"
+           :files ("*.el" "out")))
+
+(package! modus-themes)

Consider giving Nix/NixOS a try! <3