From 7a1a900334653e7cadfd60e1c92c128bf9c5a951 Mon Sep 17 00:00:00 2001 From: Azat Bahawi Date: Tue, 16 Aug 2022 02:01:55 +0300 Subject: 2022-08-16 --- modules/nixfiles/default.nix | 2 +- modules/nixfiles/emacs.nix | 69 ------------ modules/nixfiles/emacs/default.nix | 81 ++++++++++++++ modules/nixfiles/emacs/doom/config.el | 183 ++++++++++++++++++++++++++++++++ modules/nixfiles/emacs/doom/custom.el | 0 modules/nixfiles/emacs/doom/init.el | 134 +++++++++++++++++++++++ modules/nixfiles/emacs/doom/packages.el | 23 ++++ 7 files changed, 422 insertions(+), 70 deletions(-) delete mode 100644 modules/nixfiles/emacs.nix create mode 100644 modules/nixfiles/emacs/default.nix create mode 100644 modules/nixfiles/emacs/doom/config.el create mode 100644 modules/nixfiles/emacs/doom/custom.el create mode 100644 modules/nixfiles/emacs/doom/init.el create mode 100644 modules/nixfiles/emacs/doom/packages.el (limited to 'modules') 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.nix deleted file mode 100644 index 230b965..0000000 --- a/modules/nixfiles/emacs.nix +++ /dev/null @@ -1,69 +0,0 @@ -{ - config, - lib, - pkgs, - ... -}: -with lib; let - cfg = config.nixfiles.modules.emacs; -in { - options.nixfiles.modules.emacs.enable = - mkEnableOption "Whether to enable the GNU Emacs."; - - # TODO Nixify. - config = mkIf cfg.enable { - hm = { - home = { - packages = with pkgs; [ - cmigemo # :lang japanese - gcc # :lang (org +roam2) - gnuplot # :lang (org +gnuplot) - gnutls # :app irc - graphviz # :lang (org +roam2) - grip # :lang (markdown +grip) - maim # :lang (org +dragndrop) - pandoc # :lang org markdown latex - plantuml # :lang plantuml - pre-commit # :tools magit - sqlite # :lang (org +roam2) - texlive.combined.scheme-full # :lang org tex - xclip # :os (tty +osc) - ]; - - activation = { - symlinkMigemoFiles = '' - target="${config.dirs.data}/migemo" - [[ -L "$target" ]] && rm "$target" - ln -s ${pkgs.cmigemo}/share/migemo "$target" - ''; - symlinkSkkFiles = '' - target="${config.dirs.data}/skk" - [[ -L "$target" ]] && rm "$target" - ln -s ${pkgs.skk-dicts}/share "$target" - ''; - symlinkPlantumlFiles = '' - target="${config.dirs.data}/plantuml" - [[ -L "$target" ]] && rm "$target" - ln -s ${pkgs.plantuml}/lib "$target" - ''; - }; - }; - - programs.emacs = { - enable = true; - package = pkgs.emacs28.override {nativeComp = true;}; - extraPackages = p: - with p; [ - vterm # :term vterm - ]; - }; - - services.emacs = { - enable = true; - client.enable = true; - }; - }; - - fonts.fonts = with pkgs; [emacs-all-the-icons-fonts]; - }; -} diff --git a/modules/nixfiles/emacs/default.nix b/modules/nixfiles/emacs/default.nix new file mode 100644 index 0000000..3ebab5f --- /dev/null +++ b/modules/nixfiles/emacs/default.nix @@ -0,0 +1,81 @@ +{ + config, + inputs, + lib, + pkgs, + ... +}: +with lib; let + cfg = config.nixfiles.modules.emacs; +in { + options.nixfiles.modules.emacs.enable = + mkEnableOption "Whether to enable the GNU Emacs."; + + # TODO Nixify. + config = mkIf cfg.enable { + hm = { + imports = [ + inputs.nix-doom-emacs.hmModule + ]; + + home = { + packages = with pkgs; [ + cmigemo # :lang japanese + gcc # :lang (org +roam2) + gnuplot # :lang (org +gnuplot) + gnutls # :app irc + graphviz # :lang (org +roam2) + grip # :lang (markdown +grip) + maim # :lang (org +dragndrop) + pandoc # :lang org markdown latex + plantuml # :lang plantuml + pre-commit # :tools magit + sqlite # :lang (org +roam2) + texlive.combined.scheme-full # :lang org tex + xclip # :os (tty +osc) + ]; + + activation = { + symlinkMigemoFiles = '' + target="${config.dirs.data}/migemo" + [[ -L "$target" ]] && rm "$target" + ln -s ${pkgs.cmigemo}/share/migemo "$target" + ''; + symlinkSkkFiles = '' + target="${config.dirs.data}/skk" + [[ -L "$target" ]] && rm "$target" + ln -s ${pkgs.skk-dicts}/share "$target" + ''; + symlinkPlantumlFiles = '' + target="${config.dirs.data}/plantuml" + [[ -L "$target" ]] && rm "$target" + ln -s ${pkgs.plantuml}/lib "$target" + ''; + }; + }; + + 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 = { + enable = true; + client.enable = true; + }; + }; + + fonts.fonts = with pkgs; [emacs-all-the-icons-fonts]; + }; +} 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 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) -- cgit 1.4.1