forked from manveru/neovim-flake
-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
608 lines (507 loc) · 15.6 KB
/
flake.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
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
{
description = "NeoVim config";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05";
nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
neovim.url = "github:nix-community/neovim-nightly-overlay";
# Nix language server
nil.url = "github:oxalica/nil";
# -- Vim plugins
# Tab bar at the top of the editor
barbar-nvim = {
url = "github:romgrk/barbar.nvim";
flake = false;
};
# nvim-cmp source for buffer words
cmp-buffer = {
url = "github:hrsh7th/cmp-buffer";
flake = false;
};
# nvim-cmp source for vim's cmdline
cmp-cmdline = {
url = "github:hrsh7th/cmp-cmdline";
flake = false;
};
# luasnip completion source for nvim-cmp
cmp_luasnip = {
url = "github:saadparwaiz1/cmp_luasnip";
flake = false;
};
# nvim-cmp source for neovim builtin LSP client
cmp-nvim-lsp = {
url = "github:hrsh7th/cmp-nvim-lsp";
flake = false;
};
# nvim-cmp source for path
cmp-path = {
url = "github:hrsh7th/cmp-path";
flake = false;
};
# Neovim plugin for GitHub Copilot
copilot-vim = {
url = "github:github/copilot.vim";
flake = false;
};
# A language support plugin for Elixir
elixir-nvim = {
url = "github:mhanberg/elixir.nvim/v0.16.1";
flake = false;
};
# An lsp status indicator for Neovim
fidget-nvim = {
url = "github:j-hui/fidget.nvim";
flake = false;
};
# A format runner for Neovim
formatter-nvim = {
url = "github:mhartington/formatter.nvim";
flake = false;
};
# Set of preconfigured snippets for different languages
# TODO: Integrate with LuaSnip
friendly-snippets = {
url = "github:rafamadriz/friendly-snippets";
flake = false;
};
# Git integration for buffers
gitsigns-nvim = {
url = "github:lewis6991/gitsigns.nvim";
flake = false;
};
# Retro groove color scheme for Vim
gruvbox = {
url = "github:morhetz/gruvbox";
flake = false;
};
# A plugin for adding indent guides for Neovim
indent-blankline-nvim = {
url = "github:lukas-reineke/indent-blankline.nvim";
flake = false;
};
# A plugin for advanced haskell lsp support
haskell-tools = {
url = "github:mrcjkb/haskell-tools.nvim";
flake = false;
};
# TODO: A regexp parser reguired by LuaSnip for some extended fns
# Ref: https://github.com/L3MON4D3/LuaSnip/blob/master/DOC.md#transformations
# jsregexp = {
# url = "github:kmarius/jsregexp";
# flake = false;
# };
# A light and configurable statusline/tabline plugin for Vim
lightline-vim = {
url = "github:itchyny/lightline.vim";
flake = false;
};
# A plugin to add LSP signatures
lsp_signature = {
url = "github:ray-x/lsp_signature.nvim";
flake = false;
};
# A snippet Engine for Neovim written in Lua
LuaSnip = {
url = "github:L3MON4D3/LuaSnip";
flake = false;
};
# Icon provider. Part of 'mini.nvim' library
mini-icons = {
url = "github:echasnovski/mini.icons";
flake = false;
};
# Library of 40+ independent Lua modules improving overall Neovim (version 0.8 and higher) experience with minimal effort
mini-nvim = {
url = "github:echasnovski/mini.nvim";
flake = false;
};
# A plugin to center the currently focused buffer to the middle of the screen
no-neck-pain = {
url = "github:shortcuts/no-neck-pain.nvim";
flake = false;
};
# An arctic, north-bluish clean and elegant Vim theme
nord-vim = {
url = "github:arcticicestudio/nord-vim";
flake = false;
};
# A language server to inject LSP diagnostics, code actions, and more via Lua
# TODO: migrate non-lsp actions to lsp
# Example: https://nullvoxpopuli.com/2023-03-13-null-ls
null-ls-nvim = {
url = "github:nvimtools/none-ls.nvim";
flake = false;
};
# A git blame line viewing plugin
nvim-blame-line = {
url = "github:tveskag/nvim-blame-line";
flake = false;
};
# A Lua completion plugin
nvim-cmp = {
url = "github:hrsh7th/nvim-cmp";
flake = false;
};
# A high performance Neovim colorizer
nvim-colorizer-lua = {
url = "github:norcalli/nvim-colorizer.lua";
flake = false;
};
# Debug Adapter Protocol client implementation for Neovim
nvim-dap = {
url = "github:mfussenegger/nvim-dap";
flake = false;
};
# A debug plugin to add virtual-text to nvim-dap
nvim-dap-virtual-text = {
url = "github:theHamsta/nvim-dap-virtual-text";
flake = false;
};
# A json preview and browsing plugin
nvim-jqx = {
url = "github:gennaro-tedesco/nvim-jqx";
flake = false;
};
# A VSCode 💡 for neovim's built-in LSP.
nvim-lightbulb = {
url = "github:kosayoda/nvim-lightbulb";
flake = false;
};
# Quickstart configs for Nvim LSP
nvim-lspconfig = {
url = "github:neovim/nvim-lspconfig";
flake = false;
};
# A language support plugin for Nu
nvim-nu = {
url = "github:LhKipp/nvim-nu";
flake = false;
};
# A find, filter, preview, pick fuzzy finder
nvim-telescope = {
url = "github:nvim-telescope/telescope.nvim";
flake = false;
};
# A file explorer tree plugin
nvim-tree-lua = {
url = "github:kyazdani42/nvim-tree.lua";
flake = false;
};
# An icons plugin, with light and dark variants
nvim-web-devicons = {
url = "github:kyazdani42/nvim-web-devicons";
flake = false;
};
# A Lua functions library for neovim
# Required by nvim-telescope
plenary-nvim = {
url = "github:nvim-lua/plenary.nvim";
flake = false;
};
# A three-way merge managing plugin
splice = {
url = "github:sjl/splice.vim";
flake = false;
};
symbols-outline = {
url = "github:Vaengir/symbols-outline.nvim";
flake = false;
};
# A debug to telescope integration plugin
telescope-dap = {
url = "github:nvim-telescope/telescope-dap.nvim";
flake = false;
};
# An abbreviation, coercion and substitution plugin
vim-abolish = {
url = "github:tpope/vim-abolish";
flake = false;
};
# A feature rich vim plugin for Crystal
vim-crystal = {
url = "github:vim-crystal/vim-crystal";
flake = false;
};
# A syntax highlighter for CUE
vim-cue = {
url = "github:jjo/vim-cue";
flake = false;
};
# A same-word underlining plugin
vim-cursorword = {
url = "github:itchyny/vim-cursorword";
flake = false;
};
# A database interaction UI plugin
vim-dadbod-ui = {
url = "github:kristijanhusak/vim-dadbod-ui";
flake = false;
};
# A database interaction plugin
vim-dadbod = {
url = "github:tpope/vim-dadbod";
flake = false;
};
# A floating terminal implementation
vim-floaterm = {
url = "github:voldikss/vim-floaterm";
flake = false;
};
# A feature rich vim plugin for go
vim-go = {
url = "github:fatih/vim-go";
flake = false;
};
# A syntax highlighter for Just
vim-just = {
url = "github:NoahTheDuke/vim-just";
flake = false;
};
# A syntax highlighter, file detection and indenter for Mint
vim-mint = {
url = "github:IrenejMarc/vim-mint";
flake = false;
};
# A syntax highlighter, file detection and indenter for Nickel
vim-nickel = {
url = "github:nickel-lang/vim-nickel";
flake = false;
};
# A syntax highlighter, file detection and indenter for Nix
vim-nix = {
url = "github:LnL7/vim-nix";
flake = false;
};
# A code formatter for Haskell
vim-ormolu = {
url = "github:sdiehl/vim-ormolu";
flake = false;
};
# A syntax highlighter for slim, a rails templating DSL
vim-slim = {
url = "github:slim-template/vim-slim";
flake = false;
};
# A start page for neovim with suggested actions
vim-startify = {
url = "github:mhinz/vim-startify";
flake = false;
};
# A set of hotkeys for actions surrounding text blobs
vim-surround = {
url = "github:tpope/vim-surround";
flake = false;
};
# A test suit wrapper for various languages
vim-test = {
url = "github:vim-test/vim-test";
flake = false;
};
# A pop up menu helper that to display keybindings, ex: leader key
which-key-nvim = {
url = "github:folke/which-key.nvim";
flake = false;
};
# A pop up helper for :CMD and /SEARCH in lower left
wilder-nvim = {
url = "github:gelguy/wilder.nvim";
flake = false;
};
# A code formatter for zig
zig-vim = {
url = "github:ziglang/zig.vim";
flake = false;
};
};
outputs = {
nixpkgs,
flake-utils,
neovim,
...
} @ inputs:
flake-utils.lib.eachDefaultSystem (system: let
plugins =
pkgs.lib.subtractLists
["nixpkgs" "flake-utils" "neovim" "nil"]
(builtins.attrNames inputs);
pluginOverlay = lib.buildPluginOverlay;
pkgs = import nixpkgs {
inherit system;
config = {
# allowBroken = true;
# allowUnfree = true;
};
overlays = [
pluginOverlay
(final: prev: {
inherit (inputs.nil.packages.${system}) nil;
bashls = prev.nodePackages.bash-language-server;
cssls = prev.nodePackages.vscode-css-languageserver-bin;
dockerls = prev.nodePackages.dockerfile-language-server-nodejs;
efm-langserver = prev.buildGoModule rec {
pname = "efm-langserver";
version = "0.0.53";
vendorHash = "sha256-0YkUak6+dpxvXn6nVVn33xrTEthWqnC9MhMLm/yjFMA=";
src = prev.fetchFromGitHub {
owner = "mattn";
repo = pname;
rev = "v${version}";
sha256 = "sha256-Csm+2C9hP+dTXliADUquAb1nC+8f5j1rJ+66cqWDrCk=";
};
};
# Elixir language server
elixirls = prev.fetchzip {
url = "https://github.com/elixir-lsp/elixir-ls/releases/download/v0.24.1/elixir-ls-v0.24.1.zip";
hash = "sha256-18guwWL+oq3iXTxjqmNO0Bst29nbNH9xwdsuu8oUFz4=";
stripRoot = false;
};
htmlls = prev.nodePackages.vscode-html-languageserver-bin;
jsonls = prev.nodePackages.vscode-json-languageserver-bin;
neovim-nightly = neovim.packages.${system}.default;
nvim-treesitter-withAllGrammars = inputs.nixpkgs-unstable.legacyPackages.${system}.vimPlugins.nvim-treesitter.withAllGrammars;
# OPA Rego language server
regols = prev.buildGoModule rec {
pname = "regols";
version = "0.2.4";
vendorHash = "sha256-yJYWVQq6pbLPdmK4BVse6moMkurlmt6TBd6/vYM1xcU=";
src = prev.fetchFromGitHub {
owner = "kitagry";
repo = pname;
rev = "v${version}";
sha256 = "sha256-1L9ehqTMN9KHlvE7FBccVAXA7f3NNsLXJaTkOChT8Xo=";
};
};
statix = inputs.statix.defaultPackage.${system};
tsserver = prev.nodePackages.typescript-language-server;
vimls = prev.nodePackages.vim-language-server;
yamlls = prev.nodePackages.yaml-language-server;
})
];
};
lib = import ./lib {
inherit pkgs plugins inputs;
};
inherit (lib) neovimBuilder;
in rec {
inherit neovimBuilder pkgs;
apps = {
nvim = {
type = "app";
program = "${defaultPackage}/bin/nvim";
};
};
defaultApp = apps.nvim;
defaultPackage = packages.neovim;
overlay = self: super: {
inherit neovimBuilder;
inherit (packages) neovim;
inherit (pkgs) neovimPlugins;
};
devShells.default = pkgs.mkShell {
nativeBuildInputs = with pkgs; [
treefmt
alejandra
# Plugin enhancement deps
fd
ripgrep
];
};
packages.neovim = neovimBuilder {
config.vim = {
dashboard.startify.customHeader = ["Welcome to NeoVim"];
dashboard.startify.enable = true;
database.enable = true;
disableArrows = false;
virtualedit = "all";
editor = {
abolish = true;
colorPreview = true;
# Floaterm causes intermittent checkhealth issues due to race condition as of:
# Ref: https://github.com/voldikss/vim-floaterm/commit/4e28c8dd0271e10a5f55142fb6fe9b1599ee6160
floaterm = false;
# Might be nice to have starting from toggled off state
indentGuide = false;
retabTabs = true;
showTabs = true;
showTrailingWhitespace = true;
spell = true;
surround = true;
trimTrailingWhitespace = true;
underlineCurrentWord = true;
whichKey = true;
wilder = true;
};
filetree.nvimTreeLua = {enable = true;};
fuzzyfind.telescope.enable = true;
lineNumberMode = "number";
statusline.lightline.enable = true;
tabbar.barbar.enable = true;
test.enable = true;
theme.gruvbox.enable = true;
viAlias = true;
vimAlias = true;
git = {
enable = true;
# Appears to no longer work
blameLine = false;
};
lsp = {
enable = true;
bash = true;
clang = true;
cmake = true;
crystal = true;
css = true;
docker = true;
elixir = true;
fidget = true;
gleam = true;
go = true;
haskellLspConfig = false;
haskellTools = true;
html = true;
json = true;
lightbulb = true;
mint = true;
nickel = true;
nix = true;
nu = true;
python = true;
rego = true;
ruby = true;
rust = true;
shellcheck = true;
terraform = true;
tex = true;
typescript = true;
variableDebugPreviews = true;
vimscript = true;
yaml = true;
zig = true;
};
cnoremap = {"3636" = "<c-u>undo<CR>";};
# Barbar default mappings
nnoremap = {
# Move to previous/next
"<silent> <A-,>" = "<Cmd>BufferPrevious<CR>";
"<silent> <A-.>" = "<Cmd>BufferNext<CR>";
# Re-order to previous/next
"<silent> <A-<>" = "<Cmd>BufferMovePrevious<CR>";
"<silent> <A->>" = "<Cmd>BufferMoveNext<CR>";
# Pin/unpin buffer
"<silent> <A-p>" = "<Cmd>BufferPin<CR>";
# Close buffer
"<silent> <A-c>" = "<Cmd>BufferClose<CR>";
# Magic buffer-picking mode
"<silent> <C-p>" = "<Cmd>BufferPick<CR>";
"<silent> <C-A-p>" = "<Cmd>BufferPickDelete<CR>";
# Sort automatically by...
"<silent> <leader>bb" = "<Cmd>BufferOrderByBufferNumber<CR>";
"<silent> <leader>bd" = "<Cmd>BufferOrderByDirectory<CR>";
"<silent> <leader>bl" = "<Cmd>BufferOrderByLanguage<CR>";
"<silent> <leader>bw" = "<Cmd>BufferOrderByWindowNumber<CR>";
};
};
};
});
}