summaryrefslogtreecommitdiff
path: root/modules/nixfiles/emacs.nix
blob: 230b965f2dd85859f834850a61153d86712141fe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
{
  config,
  lib,
  pkgs,
  ...
}:
with lib; let
  cfg = config.nixfiles.modules.emacs;
in {
  options.nixfiles.modules.emacs.enable =
    mkEnableOption "Whether to enable the GNU Emacs.";

  # TODO Nixify.
  config = mkIf cfg.enable {
    hm = {
      home = {
        packages = with pkgs; [
          cmigemo # :lang japanese
          gcc # :lang (org +roam2)
          gnuplot # :lang (org +gnuplot)
          gnutls # :app irc
          graphviz # :lang (org +roam2)
          grip # :lang (markdown +grip)
          maim # :lang (org +dragndrop)
          pandoc # :lang org markdown latex
          plantuml # :lang plantuml
          pre-commit # :tools magit
          sqlite # :lang (org +roam2)
          texlive.combined.scheme-full # :lang org tex
          xclip # :os (tty +osc)
        ];

        activation = {
          symlinkMigemoFiles = ''
            target="${config.dirs.data}/migemo"
            [[ -L "$target" ]] && rm "$target"
            ln -s ${pkgs.cmigemo}/share/migemo "$target"
          '';
          symlinkSkkFiles = ''
            target="${config.dirs.data}/skk"
            [[ -L "$target" ]] && rm "$target"
            ln -s ${pkgs.skk-dicts}/share "$target"
          '';
          symlinkPlantumlFiles = ''
            target="${config.dirs.data}/plantuml"
            [[ -L "$target" ]] && rm "$target"
            ln -s ${pkgs.plantuml}/lib "$target"
          '';
        };
      };

      programs.emacs = {
        enable = true;
        package = pkgs.emacs28.override {nativeComp = true;};
        extraPackages = p:
          with p; [
            vterm # :term vterm
          ];
      };

      services.emacs = {
        enable = true;
        client.enable = true;
      };
    };

    fonts.fonts = with pkgs; [emacs-all-the-icons-fonts];
  };
}