/
emacs.nix
219 lines (211 loc) · 5.89 KB
/
emacs.nix
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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
{ pkgs, ... }:
# hey, future me... you might be in here to override a package. But it's
# frustrating since you can't remember the attributes. Check out this file for a
# bunch of useful info:
# https://github.com/NixOS/nixpkgs/blob/master/pkgs/top-level/emacs-packages.nix
let
configs = [
{
file = ./emacs/init.el;
pkgs = epkgs: [ epkgs.general epkgs.delight epkgs.use-package ];
}
{
file = ./emacs/evil.el;
pkgs = epkgs: [
# there's a bug in the current source of evil-escape that causes it to
# fail to build. We'll patch it out for now and hope it gets fixed in a
# future version.
(epkgs.evil-escape.overrideAttrs (attrs: {
patches = (attrs.patches or [ ]) ++ [
(pkgs.fetchpatch {
url = "https://github.com/BrianHicks/evil-escape/commit/b548e8450570a0c8dea47b47221b728c047a9baf.patch";
sha256 = "1a2qrf4bpj7wm84qa3haqdg3pd9d8nh5vrj8v1sc0j1a9jifsbf6";
})
];
}))
epkgs.evil
epkgs.evil-commentary
epkgs.evil-ediff
epkgs.evil-exchange
epkgs.evil-matchit
epkgs.evil-surround
epkgs.evil-visualstar
];
}
{
file = ./emacs/basics.el;
pkgs = epkgs: [ epkgs.bug-hunter epkgs.shackle epkgs.smartparens epkgs.which-key epkgs.exec-path-from-shell ];
}
{
file = ./emacs/compilation.el;
pkgs = epkgs: [ ];
}
{
file = ./emacs/completion.el;
pkgs = epkgs: [ epkgs.company epkgs.company-statistics ];
}
{
file = ./emacs/diffing.el;
pkgs = epkgs: [ epkgs.evil-ediff ];
}
{
file = ./emacs/direnv.el;
pkgs = epkgs: [ epkgs.direnv ];
}
{
file = ./emacs/display.el;
pkgs = epkgs: [ epkgs.airline-themes epkgs.doom-themes epkgs.hl-todo epkgs.powerline epkgs.solaire-mode ];
}
{
file = ./emacs/eshell-config.el;
pkgs = epkgs: [ ];
}
{
file = ./emacs/folding.el;
pkgs = epkgs: [ epkgs.origami ];
}
{
file = ./emacs/git.el;
pkgs = epkgs: [ epkgs.evil-magit epkgs.magit ];
}
{
file = ./emacs/helm-config.el;
pkgs = epkgs: [ epkgs.helm epkgs.helm-ag ];
}
{
file = ./emacs/icons.el;
pkgs = epkgs: [ epkgs.all-the-icons ];
}
{
file = ./emacs/jumping.el;
pkgs = epkgs: [ epkgs.ace-window epkgs.avy ];
}
{
file = ./emacs/linting.el;
pkgs = epkgs: [ epkgs.flycheck epkgs.flycheck-status-emoji epkgs.flycheck-color-mode-line ];
}
{
file = ./emacs/projects.el;
pkgs = epkgs: [ epkgs.ag epkgs.helm-projectile epkgs.projectile ];
}
{
file = ./emacs/snippets.el;
pkgs = epkgs: [ epkgs.yasnippet ];
}
## languages ##
{
file = ./emacs/lang/coffeescript.el;
pkgs = epkgs: [ epkgs.coffee-mode ];
}
{
file = ./emacs/lang/csv.el;
pkgs = epkgs: [ epkgs.csv-mode ];
}
{
file = ./emacs/lang/dockerfile.el;
pkgs = epkgs: [ epkgs.dockerfile-mode ];
}
{
file = ./emacs/lang/dockerfile.el;
pkgs = epkgs: [ epkgs.alchemist epkgs.elixir-mode ];
}
{
file = ./emacs/lang/elm.el;
pkgs = epkgs: [
# I want a commit of elm-test-runner that has a specific bug fix! But
# the bug fix isn't in the version of MELPA available in my system's
# nixpkgs yet. I'm grateful that overriding stuff is so easy! 😁
(epkgs.elm-test-runner.overrideAttrs (attrs: {
src = pkgs.fetchFromGitHub {
owner = "juanedi";
repo = "elm-test-runner";
rev = "a31d567a64d86d36e3675347abd696824a731e0c";
sha256 = "15kgz44ylni4anz461hihrhvg24jvd7jzykqdjacsznyphfv94m9";
};
}))
epkgs.elm-mode
epkgs.flycheck-elm
];
}
{
file = ./emacs/lang/graphviz.el;
pkgs = epkgs: [ epkgs.graphviz-dot-mode ];
}
{
file = ./emacs/lang/haml.el;
pkgs = epkgs: [ epkgs.haml-mode ];
}
{
file = ./emacs/lang/haskell.el;
pkgs = epkgs: [ epkgs.haskell-mode epkgs.hindent epkgs.hlint-refactor epkgs.intero ];
}
{
file = ./emacs/lang/html.el;
pkgs = epkgs: [ epkgs.emmet-mode epkgs.web-mode ];
}
{
file = ./emacs/lang/haml.el;
pkgs = epkgs: [ epkgs.idris-mode ];
}
{
file = ./emacs/lang/javascript.el;
pkgs = epkgs: [ epkgs.js2-mode epkgs.prettier-js ];
}
{
file = ./emacs/lang/json.el;
pkgs = epkgs: [ epkgs.json-mode ];
}
{
file = ./emacs/lang/markdown.el;
pkgs = epkgs: [ epkgs.markdown-mode epkgs.markdown-toc ];
}
{
file = ./emacs/lang/nix.el;
pkgs = epkgs: [ epkgs.nix-mode ];
}
{
file = ./emacs/lang/org-mode-config.el;
pkgs = epkgs: [ ];
}
{
file = ./emacs/lang/ruby.el;
pkgs = epkgs: [
epkgs.bundler
epkgs.enh-ruby-mode
epkgs.rake
epkgs.rbenv
epkgs.robe
epkgs.rspec-mode
epkgs.rubocop
epkgs.yard-mode
];
}
{
file = ./emacs/lang/rust.el;
pkgs = epkgs: [ epkgs.rust-mode ];
}
{
file = ./emacs/lang/terraform.el;
pkgs = epkgs: [ epkgs.hcl-mode epkgs.terraform-mode ];
}
{
file = ./emacs/lang/toml.el;
pkgs = epkgs: [ epkgs.toml-mode ];
}
{
file = ./emacs/lang/yaml.el;
pkgs = epkgs: [ epkgs.yaml-mode ];
}
];
extraSystemPackages = [ pkgs.ag pkgs.ispell pkgs.shellcheck ];
extraConfig = ''
(setq yas-snippet-dirs '("${./emacs-snippets}"))
'';
in {
programs.emacs.enable = true;
programs.emacs.package = pkgs.emacsMacport;
programs.emacs.extraPackages = epkgs: builtins.concatMap (config: config.pkgs epkgs) configs ++ extraSystemPackages;
home.file.".emacs.d/init.el" = {
text = builtins.foldl' (soFar: config: soFar + builtins.readFile config.file + "\n") extraConfig configs;
};
}