home

My NixOS systems configurations.
Log | Files | Refs | LICENSE

emacs.nix (4269B)


      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))' -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     # FIXME(vdemeester) once it is fixed, re-add
     19     # all-the-icons
     20     # bongo
     21     # color-identifiers-mode
     22     # consult-lsp
     23     # dap-mode
     24     # delight
     25     # dired-sidebar
     26     # dired-subtree
     27     # edit-indirect
     28     # emacs-everywhere
     29     # emms
     30     # expand-region
     31     # flymake-codespell
     32     # flymake-languagetool
     33     # fontaine
     34     # git-annex
     35     # github-review
     36     # goto-last-change
     37     # hl-todo
     38     # icomplete-vertical
     39     # kind-icon
     40     # lin
     41     # lsp-focus
     42     # lsp-mode
     43     # lsp-ui
     44     # multiple-cursors
     45     # nerd-icons
     46     # nix-buffer
     47     # org-appear
     48     # org-capture-pop-frame
     49     # org-journal
     50     # org-super-agenda
     51     # org-transclusion
     52     # pdf-tools
     53     # pkgs.dired-plus
     54     # python-mode
     55     # rainbow-delimiters
     56     # rainbow-mode
     57     # treesit-grammars.with-all-grammars
     58     # undo-tree
     59     # use-package # it's now part of built-in packages
     60     # whole-line-or-region
     61     # bbdb
     62     ace-window
     63     adoc-mode
     64     aggressive-indent
     65     alert
     66     async
     67     avy
     68     beginend
     69     cape
     70     casual-avy
     71     casual-bookmarks
     72     casual-dired
     73     casual-re-builder
     74     conner
     75     consult
     76     consult-dir
     77     consult-notes
     78     corfu
     79     corfu-candidate-overlay
     80     dape
     81     dash
     82     denote
     83     dired-collapse
     84     dired-narrow
     85     dired-rsync
     86     diredfl
     87     dockerfile-mode
     88     doom-modeline
     89     easy-kill
     90     eat
     91     edit-indirect
     92     editorconfig
     93     eldoc-box
     94     embark
     95     embark-consult
     96     envrc
     97     eshell-prompt-extras
     98     esup
     99     flimenu
    100     flymake-yamllint
    101     focus
    102     git-gutter
    103     git-gutter-fringe
    104     git-modes
    105     go-mode
    106     gotest
    107     hardhat
    108     helpful
    109     highlight
    110     highlight-indentation
    111     htmlize
    112     ibuffer-vc
    113     jinx
    114     json-mode
    115     kubed
    116     ligature
    117     macrostep
    118     magit
    119     magit-popup
    120     marginalia
    121     markdown-mode
    122     mct
    123     modus-themes
    124     multi-vterm
    125     mwim
    126     nix-mode
    127     nix-ts-mode
    128     nixpkgs-fmt
    129     no-littering
    130     ob-async
    131     ob-go
    132     ob-http
    133     orderless # TODO configure this
    134     org
    135     org-contrib
    136     org-modern
    137     org-nix-shell
    138     org-ql
    139     org-rich-yank
    140     org-tree-slide
    141     org-web-tools
    142     orgalist
    143     orgit
    144     ox-pandoc
    145     pandoc-mode
    146     pkgs.bookmark-plus # Do I use it ?
    147     popper
    148     rg
    149     ripgrep
    150     run-command # Try this out instead of conner, might be even better
    151     scratch
    152     shr-tag-pre-highlight
    153     smartparens
    154     substitute
    155     surround
    156     symbol-overlay
    157     tempel
    158     tempel-collection
    159     trashed
    160     treesit-auto
    161     try
    162     typescript-mode
    163     visual-fill-column
    164     visual-regexp
    165     vterm
    166     vundo
    167     web-mode
    168     wgrep
    169     with-editor
    170     xterm-color
    171     yaml-mode
    172   ];
    173 in
    174 {
    175   home.file.".config/emacs" = {
    176     source = config.lib.file.mkOutOfStoreSymlink "/home/vincent/src/home/tools/emacs";
    177     # recursive = true;
    178   };
    179   home.file.".local/share/applications/org-protocol.desktop".source = ./emacs/org-protocol.desktop;
    180   home.file.".local/share/applications/capture.desktop".source = ./emacs/capture.desktop;
    181   home.packages = with pkgs; [
    182     ditaa
    183     graphviz
    184     pandoc
    185     sqlite
    186     zip
    187     ugrep
    188     # See if I can hide this under an option
    189     capture
    190     # github-copilot-cli # for copilot.el
    191     nodejs
    192     ec
    193     et
    194     languagetool
    195     asciidoctor
    196     enchant
    197   ];
    198   programs.emacs = {
    199     enable = true;
    200     # FIXME: choose depending on the enabled modules
    201     package = (pkgs.emacs29.override { withTreeSitter = true; withNativeCompilation = true; withPgtk = true; withWebP = true; withGTK3 = true; withSQLite3 = true; });
    202     # package = (pkgs.emacs-pgtk.override { withGTK3 = true; withGTK2 = false; });
    203     extraPackages = myExtraPackages;
    204   };
    205   services.emacs = {
    206     enable = true;
    207     client.enable = true;
    208     #socketActivation.enable = true;
    209   };
    210   home.sessionVariables = {
    211     EDITOR = "emacs";
    212     ALTERNATE_EDITOR = "emacs -nw";
    213   };
    214 }