summaryrefslogtreecommitdiffstats
path: root/jeschli/2configs/emacs.nix
blob: caece8c9e213aa9b622d101fd627137c0bff7d17 (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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
{ config, pkgs, ... }:

let
  pkgsWithOverlay = import <nixpkgs-unstable> {
    overlays = [
      (import (builtins.fetchTarball {
        url = https://github.com/nix-community/emacs-overlay/archive/403c14c23be188b58c0b1bc197b428041d8a0cea.tar.gz;
      }))
    ];
  };

  # The emacs packages that I use
  # I differ between
  # - stable (Packages that I use for some time - happy with it)
  # - unstable (Packages that I use for some time - but may drop)
  # - testing (Packages that I try out - the new stuff)
  emacsPkgs = epkgs:
    (with epkgs.melpaPackages ;

    ## helm (stable)
    # emacs completion engine
    [ helm helm-ag ] ++

    ## deft (testing)
    # text search for a directory
    [ deft ] ++

    ## lsp mode (unstable)
    # Language Server Protocol mode
    # Used for rust
    [ company-lsp dap-mode helm-lsp lsp-mode lsp-treemacs lsp-ui ] ++

    ## emacs convenience (stable)
    # Mixed and general purpose
    [ ag company direnv evil google-this spacemacs-theme ] ++

    ## common lisp (testing)
    [ slime ] ++

    ## magit (stable)
    [ magit ] ++

    ## bunch of programming languages (unstable)
    [ go-mode haskell-mode nix-mode ] ++

    ## rust (unstable)
    [ racer rust-mode ] ++

    ## python (stable)
    # Python IDE for emacs
    [ elpy ]) ++

    ## org-mode
    # Org-Mode has several extensions
    # and can be seen as an application of its own.
    (with epkgs.melpaPackages ;
    # testing
      [ org-super-agenda org-bullets org-ql ] ++
    # unstable
      [ smex org-mime orgit ]
    ) ++

    # stable
    (with epkgs.orgPackages ;
      [ org-plus-contrib ]) ++

    (with epkgs.elpaPackages ;
      [ bbdb which-key ]);

#    ## EXWM related (unstable)
#    epkgs.exwm
#    epkgs.melpaPackages.desktop-environment
#    epkgs.melpaPackages.helm-exwm
#  ];

  emacsWithOverlay = pkgsWithOverlay.emacsWithPackagesFromUsePackage {
    config = builtins.readFile ./elisp/init.el;
    # Package is optional, defaults to pkgs.emacs
    package = pkgsWithOverlay.emacsGit;
    # Optionally provide extra packages not in the configuration file
    extraEmacsPackages = emacsPkgs;
  };

  myEmacs = pkgs.writeDashBin "my-emacs" ''
    exec ${emacsWithOverlay}/bin/emacs -q "$@"
  '';

  myEmacsWithDaemon = pkgs.writeDashBin "my-emacs-daemon" ''
    exec ${emacsWithOverlay}/bin/emacs -q --daemon
  '';

  myEmacsClient = pkgs.writeDashBin "meclient" ''
    exec ${emacsWithOverlay}/bin/emacsclient --create-frame "$@"
  '';
in {
  environment.systemPackages = [
    myEmacs myEmacsWithDaemon myEmacsClient emacsWithOverlay
  ];

## EXWM Config
#  services.xserver = {
#    enable = true;
#    xkbOptions = "caps:super";
#    exportConfiguration = true;
#
#    displayManager.slim.enable = true;
#    windowManager.default = "exwm";
#
#    # Set up the login session
#    windowManager.session = [{
#      name = "exwm";
#      start = "${emacsWithOverlay}/bin/emacs -q -l " + builtins.toString ./elisp/init.el;
#    }];
#  };
}