emacs.nix
1 { config, lib, pkgs, ... }: 2 3 with lib; 4 let 5 capture = pkgs.writeScriptBin "capture" '' 6 #!${pkgs.stdenv.shell} 7 emacsclient -n -c -F '((name . "capture") (width . 150) (height . 90) (vde/window-popup-frame . t))' -e '(org-capture)' 8 ''; 9 et = pkgs.writeScriptBin "et" '' 10 #!${pkgs.stdenv.shell} 11 emacsclient --tty $@ 12 ''; 13 ec = pkgs.writeScriptBin "ec" '' 14 #!${pkgs.stdenv.shell} 15 emacsclient --create-frame $@ 16 ''; 17 myExtraPackages = epkgs: with epkgs; [ 18 ace-window 19 adoc-mode 20 age 21 aggressive-indent 22 aidermacs 23 alert 24 async 25 avy 26 beginend 27 cape 28 casual 29 casual-avy 30 conner 31 consult 32 consult-dir 33 consult-denote 34 consult-gh 35 consult-gh-embark 36 # consult-gh-with-pr-review 37 consult-notes 38 consult-project-extra 39 consult-vc-modified-files 40 copilot 41 copilot-chat 42 corfu 43 corfu-candidate-overlay 44 dape 45 dash 46 denote 47 denote-menu 48 devdocs 49 dired-collapse 50 dired-narrow 51 dired-rsync 52 diredfl 53 dockerfile-mode 54 doom-modeline 55 easy-kill 56 eat 57 edit-indirect 58 editorconfig 59 eldoc-box 60 pr-review 61 embark 62 embark-consult 63 emms 64 envrc 65 eshell-atuin 66 eshell-prompt-extras 67 esup 68 flimenu 69 flymake-yamllint 70 focus 71 general 72 git-gutter 73 git-gutter-fringe 74 git-modes 75 go-mode 76 gotest 77 gotest-ts 78 gptel 79 hardhat 80 helpful 81 highlight 82 highlight-indentation 83 htmlize 84 ibuffer-vc 85 indent-bars 86 jinx 87 json-mode 88 kubed 89 ligature 90 macrostep 91 magit 92 magit-popup 93 marginalia 94 markdown-mode 95 minions 96 modus-themes 97 multi-vterm 98 mu4e 99 mwim 100 nix-mode 101 nix-ts-mode 102 nixpkgs-fmt 103 no-littering 104 noether 105 # notmuch 106 ob-async 107 ob-go 108 ob-http 109 orderless # TODO configure this 110 org 111 org-contrib 112 org-download 113 org-modern 114 org-nix-shell 115 org-ql 116 org-review 117 org-rich-yank 118 org-tree-slide 119 org-web-tools 120 orgalist 121 orgit 122 outline-indent 123 ox-pandoc 124 pandoc-mode 125 # password-store 126 pkgs.bookmark-plus # Do I use it ? 127 popper 128 project-rootfile 129 rg 130 run-command # Try this out instead of conner, might be even better 131 scopeline 132 scratch 133 shr-tag-pre-highlight 134 sideline 135 sideline-eglot 136 sideline-flymake 137 smartparens 138 substitute 139 surround 140 symbol-overlay 141 tempel 142 tempel-collection 143 topsy 144 trashed 145 treesit-fold 146 treesit-grammars.with-all-grammars # see how much it weight 147 try 148 typescript-mode 149 vertico 150 visual-fill-column 151 visual-regexp 152 vterm 153 vundo 154 web-mode 155 wgrep 156 with-editor 157 xterm-color 158 ]; 159 in 160 { 161 home.file.".config/emacs" = { 162 source = config.lib.file.mkOutOfStoreSymlink "/home/vincent/src/home/tools/emacs"; 163 # recursive = true; 164 }; 165 home.file.".local/share/applications/org-protocol.desktop".source = ./emacs/org-protocol.desktop; 166 home.file.".local/share/applications/capture.desktop".source = ./emacs/capture.desktop; 167 home.packages = with pkgs; [ 168 ditaa 169 graphviz 170 pandoc 171 sqlite 172 zip 173 ugrep 174 # See if I can hide this under an option 175 capture 176 # github-copilot-cli # for copilot.el 177 nodejs 178 ec 179 et 180 languagetool 181 asciidoctor 182 enchant 183 ]; 184 programs.emacs = { 185 enable = true; 186 # FIXME: choose depending on the enabled modules 187 #package = (pkgs.emacs29.override { withTreeSitter = true; withNativeCompilation = true; withPgtk = true; withWebP = true; withGTK3 = true; withSQLite3 = true; }); 188 package = (pkgs.emacs-unstable.override { withTreeSitter = true; withNativeCompilation = true; withPgtk = true; withWebP = true; withGTK3 = true; withSQLite3 = true; }); 189 extraPackages = myExtraPackages; 190 }; 191 # services.emacs = { 192 # enable = true; 193 # client.enable = true; 194 # #socketActivation.enable = true; 195 # }; 196 home.sessionVariables = { 197 EDITOR = "emacs"; 198 ALTERNATE_EDITOR = "emacs -nw"; 199 }; 200 }