about summary refs log tree commit diff
path: root/modules/emacs/default.nix
diff options
context:
space:
mode:
authorazahi <azat@bahawi.net>2025-03-12 20:17:13 +0300
committerazahi <azat@bahawi.net>2025-03-12 20:17:13 +0300
commitc81dc5a13b469c511fac6fa2390b70422d1b4da5 (patch)
tree4dab5909006ab5c25da6bd9fde6a714c7719ded7 /modules/emacs/default.nix
parent2025-02-17 (diff)
2025-03-12 HEAD master
Diffstat (limited to '')
-rw-r--r--modules/emacs/default.nix59
1 files changed, 37 insertions, 22 deletions
diff --git a/modules/emacs/default.nix b/modules/emacs/default.nix
index e546ddd..80d77a3 100644
--- a/modules/emacs/default.nix
+++ b/modules/emacs/default.nix
@@ -72,17 +72,16 @@ in
           {
             "doom/init.el".source = ./doom/init.el;
             "doom/packages.el".source = ./doom/packages.el;
-            "doom/config.el" = {
-              text = lib.concatLines [
+            "doom/config.el".text =
+              [
                 (
                   let
-                    extraBins = with pkgs; [
-                      (aspellWithDicts (
-                        p: with p; [
-                          en
-                          ru
-                        ]
-                      )) # :checkers (spell +aspell)
+                    packages = with pkgs; [
+                      (hunspellWithDicts [
+                        hunspellDicts.en-gb-large
+                        hunspellDicts.en-us-large
+                        hunspellDicts.ru-ru
+                      ]) # :checkers (spell +hunspell)
                       asmfmt # :editor format
                       shirepyright # :lang (python +lsp)
                       bash-language-server # :lang (sh +lsp)
@@ -117,8 +116,10 @@ in
                       haskell-language-server # :lang (haskell +lsp)
                       haskellPackages.cabal-fmt # :lang haskell :editor format
                       haskellPackages.hoogle # :lang haskell
+                      helm-ls
                       html-tidy # :lang web :editor format
                       jdk # :lang java :lang plantuml :checkers grammar
+                      jq # :lang (rest +jq)
                       languagetool # :checkers grammar
                       libxml2 # :lang data :editor format
                       markdownlint-cli # :lang markdown
@@ -132,7 +133,9 @@ in
                       pandoc # :lang org markdown latex
                       pinentry-emacs # doom!
                       pre-commit # :tools magit
+                      prettypst
                       python3 # :lang python
+                      python3Packages.debugpy # :lang (python +lsp) :tools debugger
                       ripgrep # doom!
                       rust-analyzer # :lang (rust +lsp)
                       rustc # :lang rust
@@ -156,18 +159,15 @@ in
                     ];
                   in
                   ''
+                    ;;; init.el -*- lexical-binding: t; -*-
+
                     ;; Integrate packages which are required by various modules
                     ;; without polluting the user's profile.
-                    (setq exec-path (append exec-path '(${lib.concatMapStringsSep " " (x: ''"${x}/bin"'') extraBins})))
-                    (setenv "PATH" (concat (getenv "PATH") ":${lib.concatMapStringsSep ":" (x: "${x}/bin") extraBins}"))
+                    (setq exec-path (append exec-path '(${lib.concatMapStringsSep " " (x: ''"${x}/bin"'') packages})))
+                    (setenv "PATH" (concat (getenv "PATH") ":${lib.concatMapStringsSep ":" (x: "${x}/bin") packages}"))
 
-                    (appendq! auth-sources '(("${config.secrets.authinfo.path}")))
+                    (prependq! auth-sources '(("${config.secrets.authinfo.path}")))
 
-                    ;; HACK Explicitly load specific Emacs packages from
-                    ;; Nixpkgs. For some reason providing them as
-                    ;; "extraPackages" doesn't work.
-                    (add-to-list 'load-path "${pkgs.mu.mu4e}/share/emacs/site-lisp/mu4e")
-                    (add-to-list 'load-path "${pkgs.emacsPackages.vterm}/share/emacs/site-lisp/elpa/vterm-${pkgs.emacsPackages.vterm.version}")
                     (load "${
                       pkgs.fetchurl {
                         name = "tvl.el";
@@ -181,14 +181,15 @@ in
                           skk-large-jisyo "${pkgs.skkDictionaries.l}/share/skk/SKK-JISYO.L")
 
                     ;; :editor parinfer
-                    (setq parinfer-rust-library "${pkgs.parinfer-rust-emacs}/lib/libparinfer_rust.so")
+                    (setq parinfer-rust-library "${pkgs.parinfer-rust-emacs}/lib/libparinfer_rust.so"
+                          parinfer-rust-auto-download nil)
 
                     ;; :lang (org +roam2) :email mu4e
                     (setq emacsql-sqlite-executable "${lib.getExe pkgs.emacsql-sqlite}")
 
                     ;; :lang plantuml
                     (setq plantuml-jar-path "${pkgs.plantuml}/lib/plantuml.jar"
-                          plantuml-executable-path "${lib.getExe' pkgs.plantuml "plantuml"}"
+                          plantuml-executable-path "${lib.getExe pkgs.plantuml}"
                           org-plantuml-jar-path plantuml-jar-path
                           org-plantuml-executable-path plantuml-executable-path)
 
@@ -233,16 +234,28 @@ in
                   ''
                 )
                 (builtins.readFile ./doom/config.el)
-              ];
-            };
+              ]
+              |> lib.concatLines;
           };
 
       programs = {
         emacs = {
           enable = true;
-          package = pkgs.emacs29-pgtk;
+          package = pkgs.emacs30-pgtk;
+          extraPackages =
+            epkgs: with epkgs; [
+              (treesit-grammars.with-grammars (
+                grammars: with grammars; [
+                  tree-sitter-typst
+                ]
+              ))
+              mu4e
+              vterm
+            ];
         };
 
+        git.extraConfig."github.com".user = lib.my.username; # :tools (magit +forge)
+
         bash.initExtra = lib.mkAfter ''
           export PATH="$PATH:$XDG_CONFIG_HOME/emacs/bin"
 
@@ -257,5 +270,7 @@ in
         '';
       };
     };
+
+    nixpkgs.overlays = [ inputs.emacs-overlay.overlays.default ];
   };
 }

Consider giving Nix/NixOS a try! <3