summaryrefslogtreecommitdiff
path: root/modules/emacs/default.nix
blob: 91a606975c006e5dbae8ffe880ec496a42eeca5f (plain) (blame)
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
{ pkgs, inputs, lib, config,  ...}:
let
  outside-emacs = with pkgs; [
    git
    nil
    ripgrep
    emacs-lsp-booster
    delta
  ];
  emacs = pkgs.emacsWithPackagesFromUsePackage {
    package = pkgs.emacs-unstable.override {
      withGTK3 = true;
      withNativeCompilation = true;
      withAlsaLib = true;
      withSystemd = true;
      withToolkitScrollBars = true;
      withImageMagick = true;
    };
    override = epkgs: let
      callPackage = pkgs.lib.callPackageWith (pkgs // epkgs);
    in epkgs // {
      eglot-booster = callPackage ./eglot-booster.nix {};
    };
    config = ./README.org;
    alwaysTangle = true;
    defaultInitFile = true;
    extraEmacsPackages = epkgs: [
      (epkgs.treesit-grammars.with-grammars (g: with g; [
        tree-sitter-rust
        tree-sitter-python
      ]))
    ];
  };
in with lib; {
  options.santi-modules.emacs.enable = mkEnableOption "Enable emacs configuration";
  config = mkIf config.santi-modules.emacs.enable {
    nixpkgs.overlays = [ inputs.emacs-overlay.overlays.default ];
    environment.systemPackages = [
      emacs
    ] ++ outside-emacs;
    fonts.packages = with pkgs; [
      nerd-fonts.dejavu-sans-mono
    ];
  };
}