blob: 1382d20c0420ebd88fbef51b3a4a72b8d7fc8e55 (
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
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
|
inputs: {
config,
pkgs,
lib,
...
}: let
inherit (pkgs.unstable) vimPlugins wrapNeovim tree-sitter;
luaFormat = inputs.self.lib.generators.lua {};
neovim-unwrapped = pkgs.unstable.neovim-unwrapped;
cfg = config.vim;
variables = with lib;
pkgs.writeTextDir "lua/myVariables.lua" ''
-- Autogenerated variables from the NixOS configuration
${(concatStringsSep
"\n"
(mapAttrsToList
(variable: value: "vim.g.${variable} = ${luaFormat.generate value}")
cfg.variables))}
'';
extraConfig = pkgs.writeTextDir "lua/myExtraConfig.lua" ''
-- luaConfig from the NixOS configuration
${cfg.luaConfig}
'';
myGeneratedConfigPackage = pkgs.symlinkJoin {
name = "myGeneratedConfig-nvim";
paths = [variables extraConfig];
};
myConfigPackage = pkgs.unstable.vimUtils.buildVimPluginFrom2Nix {
name = "myConfig-nvim";
src = ../dotfiles/vim;
};
myNeovim = wrapNeovim neovim-unwrapped {
configure = {
inherit (config.vim) beforePlugins;
customRC = ''
lua require("myVariables")
lua require("myConfig")
lua require("myExtraConfig")
${cfg.extraConfig}
'';
packages.myVimPackage = with vimPlugins; {
start =
[
myGeneratedConfigPackage
myConfigPackage
# Dependencies
plenary-nvim
popup-nvim
# UI
undotree
gruvbox-community
lualine-nvim
lualine-lsp-progress
gitsigns-nvim
diffview-nvim
nvim-notify
indent-blankline-nvim
(pkgs.unstable.vimUtils.buildVimPluginFrom2Nix {
name = "oil.nvim";
src = pkgs.fetchFromGitHub {
owner = "stevearc";
repo = "oil.nvim";
rev = "abfc455f62dac385b0fc816f37c64dffead0bcf3";
hash = "sha256-oA220nzaBlFnJ0s23oabIW3XV1tWml5kBuBkTImOPjM=";
};
})
# Completion
nvim-cmp
cmp-buffer
cmp-calc
cmp-cmdline
cmp-latex-symbols
cmp-nvim-lsp
cmp-path
cmp-spell
cmp-tmux
cmp-treesitter
cmp-vsnip
# Snippets
vim-vsnip
vim-vsnip-integ
# Telescope
telescope-nvim
telescope-ui-select-nvim
# Treesitter
nvim-treesitter.withAllGrammars
nvim-treesitter-textobjects
nvim-treesitter-context
nvim-treesitter-refactor
vim-matchup
# Motions
camelcasemotion
vim-surround
targets-vim
neoformat
# Languages
editorconfig-nvim
vim-pandoc
# Fixes "duplicated vim plugin" issue
(refactoring-nvim.overrideAttrs (old: {dependencies = [];}))
# Other
comment-nvim
impatient-nvim
null-ls-nvim
tabular
tmux-complete-vim
vim-abolish
vim-fugitive
vim-oscyank
vim-repeat
vim-rhubarb
vim-unimpaired
]
++ config.vim.extraPlugins;
};
};
};
in {
options.vim = with lib; {
variables = mkOption {
type = types.attrsOf luaFormat.type;
default = {};
description = "Extra global variables to add at the beginning of the vim configuration.";
};
extraPlugins = mkOption {
type = with types; listOf package;
default = [];
description = "Names of extra plugins to add";
};
beforePlugins = mkOption {
type = types.lines;
default = "";
description = "Extra lines to add in the vim configuration before loading plugins";
};
extraConfig = mkOption {
type = types.lines;
default = "";
description = "Extra lines to add at the end of the vim configuration";
};
luaConfig = mkOption {
type = types.lines;
default = "";
description = "Lua Neovim configuration";
};
wrappedPackage = mkOption {
type = types.package;
description = "Resulting wrapped Neovim package";
readOnly = true;
};
};
config = {
vim = {
wrappedPackage = myNeovim;
variables = {
dominant_color = "${config.theme.colors.dominant}";
ripgrep_path = "${pkgs.ripgrep}/bin/rg";
fd_path = "${pkgs.fd}/bin/fd";
};
};
environment.systemPackages = with pkgs.unstable; [
myNeovim
neovide
deadnix
statix
# TODO: add global vale config
vale
];
environment.sessionVariables = {
EDITOR = "nvim";
MANPAGER = "nvim +Man!";
NEOVIDE_MULTIGRID = "true";
};
home-manager.users.minijackson.xdg.dataFile."nvim/backup/.keep".text = "";
home-manager.users.root.xdg.dataFile."nvim/backup/.keep".text = "";
};
}
|