about summary refs log tree commit diff
path: root/modules/common/emacs/default.nix
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--modules/common/emacs/default.nix58
1 files changed, 21 insertions, 37 deletions
diff --git a/modules/common/emacs/default.nix b/modules/common/emacs/default.nix
index b16fb83..fe2618d 100644
--- a/modules/common/emacs/default.nix
+++ b/modules/common/emacs/default.nix
@@ -22,6 +22,9 @@ in {
       fonts.enable = true;
       git.client.enable = true;
       gnupg.enable = true;
+      password-store.enable = true;
+      profiles.dev.enable = true;
+      profiles.email.enable = true;
     };
 
     hm = {
@@ -33,7 +36,7 @@ in {
             export DOOMDIR="''${XDG_CONFIG_HOME:-$HOME/.config}/doom"
 
             if [[ ! -d "$EMACSDIR/.git" ]]; then
-              ${git.package}/bin/git clone --depth=1 --branch=master \
+              ${getExe git.package} clone --depth=1 --branch=master \
                 "https://github.com/doomemacs/doomemacs" "$EMACSDIR"
             fi
 
@@ -58,19 +61,24 @@ in {
           text = concatLines [
             (
               let
+                # NOTE Packages required for vterm here are mostly only used for
+                # initially compiling the libvterm library.
                 extraBins = with pkgs;
                   [
                     (aspellWithDicts (p: with p; [en ru])) # :checkers (spell +aspell)
                     asmfmt # :editor format
                     cargo # :lang rust
                     clang-tools # :lang (cc +lsp) :editor format
+                    cmake # :lang cc :term vterm
                     cmake-format # :lang cc :editor format
                     cmigemo # :lang japanese
                     dockerfile-language-server-nodejs # :tools (docker +lsp)
                     dockfmt # :tools docker :editor format
                     editorconfig-core-c # :tools editorconfig
                     fd # doom!
+                    gcc # :lang cc :term vterm
                     ghc # :lang haskell
+                    gnumake # :term vterm
                     gnuplot # :lang (org +gnuplot)
                     gnutls # doom!
                     go # :lang go
@@ -89,6 +97,7 @@ in {
                     haskellPackages.ormolu # :lang haskell :editor format
                     html-tidy # :lang web :editor format
                     jre # :lang plantuml
+                    libtool # :term vterm
                     libxml2 # :lang data :editor format
                     nil # :lang (nix +lsp)
                     nodePackages.bash-language-server # :lang (sh +lsp)
@@ -98,6 +107,7 @@ in {
                     nodePackages.stylelint # :lang web
                     nodejs # :tools debugger
                     pandoc # :lang org markdown latex
+                    perl # :term vterm
                     pinentry-emacs # doom!
                     pipenv # :lang python
                     pre-commit # :tools magit
@@ -108,7 +118,7 @@ in {
                     python3Packages.pyflakes # :lang python :editor format
                     python3Packages.pytest # :lang python
                     python3Packages.python-lsp-server # :lang python :editor format
-                    racket # :lang racket :editor format
+                    racket # :lang racket scheme :editor format
                     ripgrep # doom!
                     rust-analyzer # :lang (rust +lsp)
                     rustc # :lang rust
@@ -135,8 +145,8 @@ in {
                     else [lldb] # :tools debugger
                   );
               in ''
-                ;; This will integrate packages which are required by various
-                ;; modules without polluting the user's profile.
+                ;; Integrate packages which are required by various modules
+                ;; without polluting the user's profile.
                 (setq exec-path (append exec-path '(${
                   concatMapStringsSep " " (x: ''"${x}/bin"'') extraBins
                 })))
@@ -146,6 +156,8 @@ in {
 
                 (appendq! auth-sources '(("${config.secrets.authinfo.path}")))
 
+                (setq emacsql-sqlite-executable "${getExe pkgs.emacsql-sqlite}")
+
                 ;; The font must be set to n+2, otherwise it looks too small.
                 (setq doom-font (font-spec
                                   :family "${config.fontScheme.monospaceFont.family}"
@@ -159,7 +171,7 @@ in {
 
                 ;; :lang plantuml
                 (setq plantuml-jar-path "${pkgs.plantuml}/lib/plantuml.jar"
-                      plantuml-executable-path "${pkgs.plantuml}/bin/plantuml"
+                      plantuml-executable-path "${getExe' pkgs.plantuml "plantuml"}"
                       org-plantuml-jar-path plantuml-jar-path
                       org-plantuml-executable-path plantuml-executable-path)
 
@@ -170,8 +182,9 @@ in {
                 (setq skk-large-jisyo "${pkgs.skk-dicts}/share/skk/SKK-JISYO.L")
 
                 ;; :lang nix
+                ;; HACK Trick `nix-mode' to use alejandra instead of nixfmt.
                 (setq nix-nixfmt-bin "${pkgs.writeShellScript "nixfmt" ''
-                  ${pkgs.alejandra}/bin/alejandra --quiet "$@"
+                  ${getExe pkgs.alejandra} "$@"
                 ''}")
               ''
             )
@@ -197,8 +210,7 @@ in {
                   '')
                 muAccounts;
             in ''
-              ;; A stupid hack. This needs to be fixed upstream in either Doom
-              ;; or Nixpkgs.
+              ;; HACK Load missing site-lisp for `mu4e'.
               (add-to-list 'load-path "${pkgs.mu.mu4e}/share/emacs/site-lisp/mu4e")
 
               (setq mu4e-root-maildir "${maildirBasePath}")
@@ -216,7 +228,7 @@ in {
           (pkgs.emacs29.override (finalAttrs: {
             stdenv = with pkgs;
               useMoldLinker
-              (withCFlags ["-O2"]
+              (withCFlags ["-O3"]
                 (impureUseNativeOptimizations finalAttrs.stdenv));
           }))
           .overrideAttrs (_: final: {
@@ -227,34 +239,6 @@ in {
                 "--without-pop"
               ];
           });
-        # TODO https://github.com/NixOS/nixpkgs/issues/267548
-        # packageX = let
-        #   emacs = "emacs29"; # Pin the version to avoid surprises.
-        # in
-        #   (pkgs.${emacs}.pkgs.overrideScope
-        #     (_: super: {
-        #       emacs =
-        #         (pkgs.${emacs}.override (finalAttrs: {
-        #           stdenv = with pkgs;
-        #             useMoldLinker
-        #             (withCFlags ["-O2"]
-        #               (impureUseNativeOptimizations finalAttrs.stdenv));
-        #         }))
-        #         .overrideAttrs (_: final: {
-        #           configureFlags =
-        #             final.configureFlags
-        #             ++ [
-        #               "--without-mailutils"
-        #               "--without-pop"
-        #             ];
-        #         });
-        #     }))
-        #   .withPackages (p:
-        #     with p; [
-        #       emacsql # :tools magit
-        #       mu4e # :email mu4e
-        #       vterm # :term vterm
-        #     ]);
       };
     };
   };

Consider giving Nix/NixOS a try! <3