about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAzat Bahawi <azat@bahawi.net>2023-11-26 02:03:29 +0300
committerAzat Bahawi <azat@bahawi.net>2023-11-26 02:03:29 +0300
commit2ceeed9040d0b5a015fd634122afcf35f432ba45 (patch)
tree78d3dda30937da38cdda4c9a0367653948538a53
parent2023-11-25 (diff)
2023-11-26
-rw-r--r--modules/common/emacs/default.nix58
-rw-r--r--modules/common/emacs/doom/config.el29
-rw-r--r--modules/common/emacs/doom/init.el36
-rw-r--r--modules/common/emacs/doom/packages.el2
-rw-r--r--overlay.nix2
-rw-r--r--packages/parinfer-rust.nix29
6 files changed, 107 insertions, 49 deletions
diff --git a/modules/common/emacs/default.nix b/modules/common/emacs/default.nix
index 6c81ce2..94c7729 100644
--- a/modules/common/emacs/default.nix
+++ b/modules/common/emacs/default.nix
@@ -40,7 +40,7 @@ in {
                 "https://github.com/doomemacs/doomemacs" "$EMACSDIR"
             fi
 
-            if [[ ! -d "$DOOMDIR" ]]; then
+            if [[ ! -d "$DOOMDIR/snippets" ]]; then
               mkdir -p "$DOOMDIR/snippets"
             fi
 
@@ -67,6 +67,7 @@ in {
                   [
                     (aspellWithDicts (p: with p; [en ru])) # :checkers (spell +aspell)
                     asmfmt # :editor format
+                    bashdb # :lang sh :tools debugger
                     cargo # :lang rust
                     clang-tools # :lang (cc +lsp) :editor format
                     cmake # :lang cc :term vterm
@@ -80,7 +81,8 @@ in {
                     ghc # :lang haskell
                     gnumake # :term vterm
                     gnuplot # :lang (org +gnuplot)
-                    gnutls # doom!
+                    gnutar # :tools tree-sitter
+                    gnutls # doom! :app irc
                     go # :lang go
                     gocode # :lang go org
                     godef # :lang go
@@ -90,15 +92,18 @@ in {
                     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
-                    jre # :lang plantuml
+                    jdk # :lang java :lang plantuml :checkers grammar
+                    languagetool # :checkers grammar
                     libtool # :term vterm
                     libxml2 # :lang data :editor format
+                    markdownlint-cli # :lang markdown
                     nil # :lang (nix +lsp)
                     nodePackages.bash-language-server # :lang (sh +lsp)
                     nodePackages.eslint # :lang (json +lsp)
@@ -121,12 +126,10 @@ in {
                     python3Packages.pyflakes # :lang python :editor format
                     python3Packages.pytest # :lang python
                     python3Packages.python-lsp-server # :lang python :editor format
-                    racket # :lang racket scheme :editor format
                     ripgrep # doom!
                     rust-analyzer # :lang (rust +lsp)
                     rustc # :lang rust
                     rustfmt # :lang rust
-                    sbcl # :lang common-lisp
                     shellcheck # :lang sh
                     shfmt # :lang sh :editor format
                     sqlite # :lang (org +roam2) :tools lookup
@@ -158,9 +161,13 @@ in {
                   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 emacsql-sqlite-executable "${getExe pkgs.emacsql-sqlite}")
+                (appendq! auth-sources '(("${config.secrets.authinfo.path}")))
 
                 ;; The font must be set to n+2, otherwise it looks too small.
                 (setq doom-font (font-spec
@@ -168,28 +175,34 @@ in {
                                   :size ${toString (config.fontScheme.monospaceFont.size + 2)})
                       doom-unicode-font doom-font)
 
-                ;; :app irc
-                (setq circe-default-nick "${my.username}"
-                      circe-default-realname "${my.email}"
-                      circe-default-user circe-default-nick)
-
-                ;; :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)
-
                 ;; :input japanese
-                (setq migemo-dictionary "${pkgs.cmigemo}/share/migemo/utf-8/migemo-dict")
+                (setq migemo-dictionary "${pkgs.cmigemo}/share/migemo/utf-8/migemo-dict"
+                      skk-large-jisyo "${pkgs.skk-dicts}/share/SKK-JISYO.L")
 
-                ;; :input japanese
-                (setq skk-large-jisyo "${pkgs.skk-dicts}/share/skk/SKK-JISYO.L")
+                ;; :editor parinfer
+                (setq parinfer-rust-auto-download nil
+                      parinfer-rust-library "${pkgs.parinfer-rust}/lib/libparinfer_rust.so")
 
                 ;; :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 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)
               ''
             )
             (with config.hm.accounts.email; let
@@ -214,9 +227,6 @@ in {
                   '')
                 muAccounts;
             in ''
-              ;; 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}")
 
               ${mu4eAccounts}
diff --git a/modules/common/emacs/doom/config.el b/modules/common/emacs/doom/config.el
index 257a3ea..dee3d3d 100644
--- a/modules/common/emacs/doom/config.el
+++ b/modules/common/emacs/doom/config.el
@@ -33,6 +33,16 @@
       lsp-modeline-code-actions-enable nil)
 
 ;;
+;;; Go
+;;
+
+(setq lsp-go-analyses '((shadow . t)
+                        (unsedvariable . t)
+                        (unusedparams . t)
+                        (unusedwrite . t)
+                        (useany . t)))
+
+;;
 ;;; Org
 ;;
 
@@ -107,6 +117,13 @@
         org-roam-ui-open-on-start t))
 
 ;;
+;;; LaTeX
+;;
+
+(map! :map cdlatex-mode-map
+      :i "TAB" #'cdlatex-tab)
+
+;;
 ;;; PlantUML
 ;;
 
@@ -187,6 +204,18 @@
               '("libera" "oftc" "hackint" "rizon")))
 
 ;;
+;;; Fcitx
+;;
+
+(use-package! fcitx
+  :after evil
+  :config
+  (when (setq fcitx-remote-command
+              (or (executable-find "fcitx5-remote")
+                  (executable-find "fcitx-remote")))
+    (fcitx-evil-turn-on)))
+
+;;
 ;;; Hledger
 ;;
 
diff --git a/modules/common/emacs/doom/init.el b/modules/common/emacs/doom/init.el
index f03971f..0a5a417 100644
--- a/modules/common/emacs/doom/init.el
+++ b/modules/common/emacs/doom/init.el
@@ -1,26 +1,20 @@
 (doom! :input
-       ;; japanese
+       japanese
 
        :completion
        company
        vertico
 
        :ui
-       ;; deft
        doom
-       ;; doom-dashboard
-       ;; doom-quit
        (emoji +unicode)
        hl-todo
-       hydra
        indent-guides
        ligatures
        modeline
-       ;; nav-flash
+       nav-flash
        ophints
        (popup +defaults)
-       ;; tabs
-       ;; unicode
        (vc-gutter +diff-hl +pretty)
        window-select
        workspaces
@@ -30,10 +24,7 @@
        file-templates
        fold
        format
-       ;; lispy
-       ;; multiple-cursors
        parinfer
-       ;; rotate-text
        snippets
        word-wrap
 
@@ -63,7 +54,7 @@
        gist
        (lookup +dictionary +offline)
        (lsp +peek)
-       (magit +forge)
+       magit
        make
        (pass +auth)
        pdf
@@ -76,27 +67,24 @@
 
        :lang
        (cc +lsp +tree-sitter)
-       (common-lisp +lsp +tree-sitter)
        data
-       (dhall +lsp +tree-sitter)
-       (emacs-lisp +lsp +tree-sitter)
+       dhall
+       emacs-lisp
        (go +lsp +tree-sitter)
        (haskell +lsp +tree-sitter)
        (java +lsp +tree-sitter)
        (javascript +lsp +tree-sitter)
        (json +lsp +tree-sitter)
-       (kotlin +lsp +tree-sitter)
-       (latex +lsp +tree-sittter)
-       (markdown +lsp +tree-sitter)
+       kotlin
+       (latex +latexmk +cdlatex +lsp)
+       markdown
        (nix +lsp +tree-sitter)
-       (org +pandoc +roam2)
+       (org +contacts +gnuplot +pandoc +pomodoro +roam2)
        plantuml
-       (python +lsp +tree-sitter)
-       (racket +lsp +tree-sitter)
+       (python +poetry +lsp +tree-sitter)
        (rust +lsp +tree-sitter)
-       (scheme +lsp +tree-sitter +racket)
        (sh +lsp +tree-sitter)
-       web
+       (web +lsp +tree-sitter)
        (yaml +lsp +tree-sitter)
        (zig +lsp +tree-sitter)
 
@@ -105,8 +93,6 @@
 
        :app
        calendar
-       ;; emms
-       ;; everywhere
        irc
        (rss +org)
 
diff --git a/modules/common/emacs/doom/packages.el b/modules/common/emacs/doom/packages.el
index 26a1d31..ba24eb8 100644
--- a/modules/common/emacs/doom/packages.el
+++ b/modules/common/emacs/doom/packages.el
@@ -10,3 +10,5 @@
            :branch "main"))
 
 (package! hledger-mode)
+
+(package! fcitx)
diff --git a/overlay.nix b/overlay.nix
index 74e0746..1cc33a1 100644
--- a/overlay.nix
+++ b/overlay.nix
@@ -11,6 +11,8 @@ final: prev: {
 
   openssl_1_0_0 = prev.callPackage ./packages/openssl_1_0_0.nix {};
 
+  parinfer-rust = prev.callPackage ./packages/parinfer-rust.nix {};
+
   logcli = prev.grafana-loki.overrideAttrs (_: super: {
     pname = "logcli";
     subPackages = ["cmd/logcli"];
diff --git a/packages/parinfer-rust.nix b/packages/parinfer-rust.nix
new file mode 100644
index 0000000..6bf07dd
--- /dev/null
+++ b/packages/parinfer-rust.nix
@@ -0,0 +1,29 @@
+{
+  lib,
+  fetchFromGitHub,
+  rustPlatform,
+}:
+rustPlatform.buildRustPackage rec {
+  pname = "parinfer-rust";
+  version = "unstable-2023-08-23";
+
+  src = fetchFromGitHub {
+    owner = "eraserhd";
+    repo = "parinfer-rust";
+    rev = "0e4d52e712641ad351a1bfe6cee3d34d63ed087b";
+    hash = "sha256-xYdSOQMqeIaN5ADiwg5DkjyworcT6FWGJvJUV1NOb+0=";
+  };
+
+  cargoHash = "sha256-C8RO6A1soSjtGzmtkwtApObAvS7YRqHnc0JwcHzoP/8=";
+
+  buildFeatures = ["emacs"];
+
+  nativeBuildInputs = [rustPlatform.bindgenHook];
+
+  meta = with lib; {
+    description = "A Rust port of parinfer";
+    inherit (finalAttrs.src.meta) homepage;
+    license = licenses.isc;
+    maintainers = with maintainers; [azahi];
+  };
+}

Consider giving Nix/NixOS a try! <3