about summary refs log tree commit diff
path: root/modules/common/emacs/default.nix
diff options
context:
space:
mode:
authorAzat Bahawi <azat@bahawi.net>2024-03-19 11:58:43 +0300
committerAzat Bahawi <azat@bahawi.net>2024-03-19 11:58:43 +0300
commit4ad0c3afc1f6caf0c3f05f99a15b22178f2c190b (patch)
tree1365e49e1875baa2352ac6cb357255a9f502b563 /modules/common/emacs/default.nix
parent2024-03-19 (diff)
2024-03-19
Diffstat (limited to '')
-rw-r--r--modules/common/emacs/default.nix270
1 files changed, 135 insertions, 135 deletions
diff --git a/modules/common/emacs/default.nix b/modules/common/emacs/default.nix
index 17183fc..9259011 100644
--- a/modules/common/emacs/default.nix
+++ b/modules/common/emacs/default.nix
@@ -60,150 +60,150 @@ in {
         "doom/packages.el".source = ./doom/packages.el;
         "doom/config.el" = {
           text = concatLines [
-            (
-              let
-                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-format # :lang cc :editor format
-                    cmigemo # :lang japanese
-                    config.hm.programs.emacs.package # !doom
-                    config.nix.package # !doom
-                    delve # :lang go :tools debugger
-                    dockerfile-language-server-nodejs # :tools (docker +lsp)
-                    dockfmt # :tools docker :editor format
-                    editorconfig-core-c # :tools editorconfig
-                    fd # doom!
-                    gcc # :lang cc
-                    ghc # :lang haskell
-                    gnuplot # :lang (org +gnuplot)
-                    gnutar # :tools tree-sitter
-                    gnutls # doom! :app irc
-                    go # :lang go
-                    godef # :lang go
-                    gomodifytags # :lang go
-                    gopls # :lang (go +lsp)
-                    gore # :lang go
-                    gotests # :lang go
-                    gotools # :lang go
-                    graphviz # :lang (org +roam2) :lang plantuml
-                    gzip # :tools tree-sitter
-                    haskellPackages.cabal-fmt # :lang haskell :editor format
-                    haskellPackages.cabal-install # :lang haskell
-                    haskellPackages.haskell-language-server # :lang (haskell +lsp)
-                    haskellPackages.hoogle # :lang haskell
-                    haskellPackages.ormolu # :lang haskell :editor format
-                    html-tidy # :lang web :editor format
-                    jdk # :lang java :lang plantuml :checkers grammar
-                    languagetool # :checkers grammar
-                    libxml2 # :lang data :editor format
-                    markdownlint-cli # :lang markdown
-                    nil # :lang (nix +lsp)
-                    nls # :lang (nickel +lsp)
-                    nodePackages.bash-language-server # :lang (sh +lsp)
-                    nodePackages.eslint # :lang (json +lsp)
-                    nodePackages.js-beautify # :lang web
-                    nodePackages.prettier # :editor format
-                    nodePackages.stylelint # :lang web
-                    nodePackages.vscode-css-languageserver-bin # lang (web +lsp)
-                    nodePackages.vscode-html-languageserver-bin # lang (web +lsp)
-                    nodePackages.vscode-json-languageserver-bin # lang (json +lsp)
-                    nodejs # :tools debugger
-                    pandoc # :lang org markdown latex
-                    pinentry-emacs # doom!
-                    pipenv # :lang python
-                    poetry # :lang python
-                    pre-commit # :tools magit
-                    python3 # :lang python
-                    python3Packages.black # :lang python :editor format
-                    python3Packages.isort # :lang python :editor format
-                    python3Packages.nose # :lang python
-                    python3Packages.pyflakes # :lang python :editor format
-                    python3Packages.pytest # :lang python
-                    python3Packages.python-lsp-server # :lang python :editor format
-                    ripgrep # doom!
-                    rust-analyzer # :lang (rust +lsp)
-                    rustc # :lang rust
-                    rustfmt # :lang rust
-                    shellcheck # :lang sh
-                    shfmt # :lang sh :editor format
-                    sqlite # :lang (org +roam2) :tools lookup
-                    terraform-ls # :tools (terraform +lsp)
-                    texlab # lang (tex +lsp)
-                    texlive.combined.scheme-full # :lang org tex
-                    unzip # :tools debugger
-                    wordnet # :tools (lookup +dictionary +offline)
-                    yaml-language-server # :lang (yaml +lsp)
-                    zig # :lang zig :editor format
-                    zls # :lang (zig +lsp)
-                    zstd # :emacs undo
-                  ]
-                  ++ (
-                    # GDB doesn't support[1] Apple Silicon.
-                    #
-                    # [1]: https://inbox.sourceware.org/gdb/6b48224b-9e2e-518d-793b-df4fc5514884@arm.com/
-                    if (this.system != "aarch64-darwin")
-                    then [gdb] # :tools debugger
-                    else [lldb] # :tools debugger
-                  );
+            (let
+              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-format # :lang cc :editor format
+                  cmigemo # :lang japanese
+                  config.hm.programs.emacs.package # !doom
+                  config.nix.package # !doom
+                  delve # :lang go :tools debugger
+                  dockerfile-language-server-nodejs # :tools (docker +lsp)
+                  dockfmt # :tools docker :editor format
+                  editorconfig-core-c # :tools editorconfig
+                  fd # doom!
+                  gcc # :lang cc
+                  ghc # :lang haskell
+                  gnuplot # :lang (org +gnuplot)
+                  gnutar # :tools tree-sitter
+                  gnutls # doom! :app irc
+                  go # :lang go
+                  godef # :lang go
+                  gomodifytags # :lang go
+                  gopls # :lang (go +lsp)
+                  gore # :lang go
+                  gotests # :lang go
+                  gotools # :lang go
+                  graphviz # :lang (org +roam2) :lang plantuml
+                  gzip # :tools tree-sitter
+                  haskellPackages.cabal-fmt # :lang haskell :editor format
+                  haskellPackages.cabal-install # :lang haskell
+                  haskellPackages.haskell-language-server # :lang (haskell +lsp)
+                  haskellPackages.hoogle # :lang haskell
+                  haskellPackages.ormolu # :lang haskell :editor format
+                  html-tidy # :lang web :editor format
+                  jdk # :lang java :lang plantuml :checkers grammar
+                  languagetool # :checkers grammar
+                  libxml2 # :lang data :editor format
+                  markdownlint-cli # :lang markdown
+                  nil # :lang (nix +lsp)
+                  nls # :lang (nickel +lsp)
+                  nodePackages.bash-language-server # :lang (sh +lsp)
+                  nodePackages.eslint # :lang (json +lsp)
+                  nodePackages.js-beautify # :lang web
+                  nodePackages.prettier # :editor format
+                  nodePackages.stylelint # :lang web
+                  nodePackages.vscode-css-languageserver-bin # lang (web +lsp)
+                  nodePackages.vscode-html-languageserver-bin # lang (web +lsp)
+                  nodePackages.vscode-json-languageserver-bin # lang (json +lsp)
+                  nodejs # :tools debugger
+                  pandoc # :lang org markdown latex
+                  pinentry-emacs # doom!
+                  pipenv # :lang python
+                  poetry # :lang python
+                  pre-commit # :tools magit
+                  python3 # :lang python
+                  python3Packages.black # :lang python :editor format
+                  python3Packages.isort # :lang python :editor format
+                  python3Packages.nose # :lang python
+                  python3Packages.pyflakes # :lang python :editor format
+                  python3Packages.pytest # :lang python
+                  python3Packages.python-lsp-server # :lang python :editor format
+                  ripgrep # doom!
+                  rust-analyzer # :lang (rust +lsp)
+                  rustc # :lang rust
+                  rustfmt # :lang rust
+                  shellcheck # :lang sh
+                  shfmt # :lang sh :editor format
+                  sqlite # :lang (org +roam2) :tools lookup
+                  terraform-ls # :tools (terraform +lsp)
+                  texlab # lang (tex +lsp)
+                  texlive.combined.scheme-full # :lang org tex
+                  unzip # :tools debugger
+                  wordnet # :tools (lookup +dictionary +offline)
+                  yaml-language-server # :lang (yaml +lsp)
+                  zig # :lang zig :editor format
+                  zls # :lang (zig +lsp)
+                  zstd # :emacs undo
+                ]
+                ++ (
+                  # GDB doesn't support[1] Apple Silicon.
+                  #
+                  # [1]: https://inbox.sourceware.org/gdb/6b48224b-9e2e-518d-793b-df4fc5514884@arm.com/
+                  if (this.system != "aarch64-darwin")
+                  then [gdb] # :tools debugger
+                  else [lldb] # :tools debugger
+                );
 
-                parinferRustLibrary =
-                  if (hasSuffix "linux" this.system)
-                  then "${pkgs.parinfer-rust}/lib/libparinfer_rust.so"
-                  else "${pkgs.parinfer-rust}/lib/libparinfer_rust.dylib";
-              in ''
-                ;; 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
-                })))
-                (setenv "PATH" (concat (getenv "PATH") ":${
-                  concatMapStringsSep ":" (x: "${x}/bin") extraBins
-                }"))
-
-                ;; 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}")
+              parinferRustLibrary =
+                if (hasSuffix "linux" this.system)
+                then "${pkgs.parinfer-rust}/lib/libparinfer_rust.so"
+                else "${pkgs.parinfer-rust}/lib/libparinfer_rust.dylib";
+            in ''
+              ;; 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
+              })))
+              (setenv "PATH" (concat (getenv "PATH") ":${
+                concatMapStringsSep ":" (x: "${x}/bin") extraBins
+              }"))
 
-                (appendq! 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}")
 
-                (setq doom-font (font-spec :size 16)
-                      doom-unicode-font doom-font)
+              (appendq! auth-sources '(("${config.secrets.authinfo.path}")))
 
-                ;; :input japanese
-                (setq migemo-dictionary "${pkgs.cmigemo}/share/migemo/utf-8/migemo-dict"
-                      skk-large-jisyo "${pkgs.skk-dicts}/share/SKK-JISYO.L")
+              ;; :input japanese
+              (setq migemo-dictionary "${pkgs.cmigemo}/share/migemo/utf-8/migemo-dict"
+                    skk-large-jisyo "${pkgs.skk-dicts}/share/SKK-JISYO.L")
 
-                ;; :editor parinfer
-                (setq parinfer-rust-auto-download nil
-                      parinfer-rust-library "${parinferRustLibrary}")
+              ;; :editor parinfer
+              (setq parinfer-rust-auto-download nil
+                    parinfer-rust-library "${parinferRustLibrary}")
 
-                ;; :lang nix
-                ;; HACK Trick `nix-mode' to use alejandra instead of nixfmt.
-                (setq nix-nixfmt-bin "${pkgs.writeShellScript "nixfmt" ''
-                  ${getExe pkgs.alejandra} "$@"
-                ''}")
+              ;; :lang nix
+              ;; HACK Trick `nix-mode' to use alejandra instead of nixfmt.
+              (setq nix-nixfmt-bin "${pkgs.writeShellScript "nixfmt" ''
+                ${getExe pkgs.alejandra} "$@"
+              ''}")
 
-                ;; :lang (org +roam2) :email mu4e
-                (setq emacsql-sqlite-executable "${getExe pkgs.emacsql-sqlite}")
+              ;; :lang (org +roam2) :email mu4e
+              (setq emacsql-sqlite-executable "${getExe pkgs.emacsql-sqlite}")
 
-                ;; :lang plantuml
-                (setq plantuml-jar-path "${pkgs.plantuml}/lib/plantuml.jar"
-                      plantuml-executable-path "${getExe' pkgs.plantuml "plantuml"}"
-                      org-plantuml-jar-path plantuml-jar-path
-                      org-plantuml-executable-path plantuml-executable-path)
+              ;; :lang plantuml
+              (setq plantuml-jar-path "${pkgs.plantuml}/lib/plantuml.jar"
+                    plantuml-executable-path "${getExe' pkgs.plantuml "plantuml"}"
+                    org-plantuml-jar-path plantuml-jar-path
+                    org-plantuml-executable-path plantuml-executable-path)
 
-                ;; :app irc
-                (setq circe-default-nick "${my.username}"
-                      circe-default-realname "${my.email}"
-                      circe-default-user circe-default-nick)
-              ''
-            )
+              ;; :app irc
+              (setq circe-default-nick "${my.username}"
+                    circe-default-realname "${my.email}"
+                    circe-default-user circe-default-nick)
+            '')
+            (with config.stylix.fonts; ''
+              (setq doom-font "${monospace.name}-${toString sizes.terminal}"
+                    doom-serif-font "${serif.name}-${toString sizes.terminal}"
+                    doom-variable-pitch-font "${sansSerif.name}-${toString sizes.terminal}")
+            '')
             (with config.hm.accounts.email; let
               mu4eAccounts = let
                 muAccounts = filter (a: a.mu.enable) (attrValues accounts);

Consider giving Nix/NixOS a try! <3