-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
294 lines (266 loc) · 8.75 KB
/
flake.nix
File metadata and controls
294 lines (266 loc) · 8.75 KB
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
{
description = "A Lua-natic's neovim flake, with extra cats! nixCats!";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
nixCats.url = "github:BirdeeHub/nixCats-nvim";
plugins-oh-lucy-nvim = {
url = "github:Yazeed1s/oh-lucy.nvim";
flake = false;
};
plugins-vim-rest-console = {
url = "github:diepm/vim-rest-console";
flake = false;
};
plugins-gp-nvim = {
url = "github:Robitx/gp.nvim";
flake = false;
};
plugins-format-on-save = {
url = "github:elentok/format-on-save.nvim";
flake = false;
};
plugins-render-markdown-nvim = {
url = "github:MeanderingProgrammer/render-markdown.nvim";
flake = false;
};
plugins-gint-nvim = {
url = "github:pneumaea/gint-nvim";
flake = false;
};
plugins-obsidian-bridge-nvim = {
url = "github:oflisback/obsidian-bridge.nvim";
flake = false;
};
plugins-obsidian-local-rest-api = {
url = "github:coddingtonbear/obsidian-local-rest-api";
flake = false;
};
# neovim-nightly-overlay = {
# url = "github:nix-community/neovim-nightly-overlay";
# };
# see :help nixCats.flake.inputs
# If you want your plugin to be loaded by the standard overlay,
# i.e. if it wasnt on nixpkgs, but doesnt have an extra build step.
# Then you should name it "plugins-something"
# If you wish to define a custom build step not handled by nixpkgs,
# then you should name it in a different format, and deal with that in the
# overlay defined for custom builds in the overlays directory.
# for specific tags, branches and commits, see:
# https://nixos.org/manual/nix/stable/command-ref/new-cli/nix3-flake.html#examples
};
outputs = { self, nixpkgs, nixCats, ... }@inputs: let
inherit (nixCats) utils;
luaPath = "${./extra}";
forEachSystem = utils.eachSystem nixpkgs.lib.platforms.all;
extra_pkg_config = {
allowUnfree = true;
};
inherit (forEachSystem (system: let
dependencyOverlays = /* (import ./overlays inputs) ++ */ [
(utils.standardPluginOverlay inputs)
];
in { inherit dependencyOverlays; })) dependencyOverlays;
categoryDefinitions = { pkgs, settings, categories, name, ... }@packageDef: {
lspsAndRuntimeDeps = {
general = with pkgs; [
emmet-language-server
lua-language-server
gopls
xclip
jq
wl-clipboard
fd
rust-analyzer
luajitPackages.lua-lsp
nodePackages.bash-language-server
yaml-language-server
typescript-language-server
pyright
marksman
black
stylua
prettierd
nodePackages.prettier
mypy
pylint
nixfmt-classic
statix
deadnix
nil
biome
];
};
startupPlugins = {
gitPlugins = with pkgs.neovimPlugins; [
oh-lucy-nvim # Default theme
vim-rest-console # Rest Client
format-on-save
render-markdown-nvim
gint-nvim
gp-nvim
obsidian-bridge-nvim
obsidian-local-rest-api
];
general = with pkgs.vimPlugins; [
# TODO: organize this stuff
nvim-lspconfig
lsp-zero-nvim
cmp-nvim-lsp
cmp-buffer
cmp-path
nvim-cmp
luasnip
copilot-vim
obsidian-nvim
nvim-treesitter-context
nvim-colorizer-lua
plenary-nvim
nvim-web-devicons
nui-nvim
nvim-notify
noice-nvim
playground
nvim-ts-autotag
harpoon
oil-nvim
telescope-nvim
undotree
yazi-nvim
rainbow-delimiters-nvim
mini-indentscope
transparent-nvim
barbar-nvim
lualine-nvim
fugitive-gitlab-vim
gitsigns-nvim
oxocarbon-nvim
poimandres-nvim
dashboard-nvim
autoclose-nvim
vim-closetag
] ++ pkgs.vimPlugins.nvim-treesitter.withAllGrammars.dependencies;
};
optionalPlugins = {
gitPlugins = with pkgs.neovimPlugins; [ ];
general = with pkgs.vimPlugins; [ ];
};
sharedLibraries = {
general = with pkgs; [
];
};
environmentVariables = {
test = {
CATTESTVAR = "It worked!";
};
};
# If you know what these are, you can provide custom ones by category here.
# If you dont, check this link out:
# https://github.com/NixOS/nixpkgs/blob/master/pkgs/build-support/setup-hooks/make-wrapper.sh
extraWrapperArgs = {
test = [
'' --set CATTESTVAR2 "It worked again!"''
];
};
# lists of the functions you would have passed to
# python.withPackages or lua.withPackages
# get the path to this python environment
# in your lua config via
# vim.g.python3_host_prog
# or run from nvim terminal via :!<packagename>-python3
extraPython3Packages = {
test = (_:[]);
};
# populates $LUA_PATH and $LUA_CPATH
extraLuaPackages = {
test = [ (_:[]) ];
};
};
# And then build a package with specific categories from above here:
# All categories you wish to include must be marked true,
# but false may be omitted.
# This entire set is also passed to nixCats for querying within the lua.
# see :help nixCats.flake.outputs.packageDefinitions
packageDefinitions = {
# These are the names of your packages
# you can include as many as you wish.
default = {pkgs , ... }: {
# they contain a settings set defined above
# see :help nixCats.flake.outputs.settings
settings = {
wrapRc = true;
# IMPORTANT:
# your alias may not conflict with your other packages.
aliases = [ "vim" ];
# neovim-unwrapped = inputs.neovim-nightly-overlay.packages.${pkgs.system}.neovim;
};
# and a set of categories that you want
# (and other information to pass to lua)
categories = {
general = true;
gitPlugins = true;
customPlugins = true;
test = true;
example = {
youCan = "add more than just booleans";
toThisSet = [
"and the contents of this categories set"
"will be accessible to your lua with"
"nixCats('path.to.value')"
"see :help nixCats"
];
};
};
};
};
# In this section, the main thing you will need to do is change the default package name
# to the name of the packageDefinitions entry you wish to use as the default.
defaultPackageName = "default";
in
# see :help nixCats.flake.outputs.exports
forEachSystem (system: let
nixCatsBuilder = utils.baseBuilder luaPath {
inherit nixpkgs system dependencyOverlays extra_pkg_config;
} categoryDefinitions packageDefinitions;
defaultPackage = nixCatsBuilder defaultPackageName;
# this is just for using utils such as pkgs.mkShell
# The one used to build neovim is resolved inside the builder
# and is passed to our categoryDefinitions and packageDefinitions
pkgs = import nixpkgs { inherit system; };
in
{
# these outputs will be wrapped with ${system} by utils.eachSystem
# this will make a package out of each of the packageDefinitions defined above
# and set the default package to the one passed in here.
packages = utils.mkAllWithDefault defaultPackage;
# choose your package for devShell
# and add whatever else you want in it.
devShells = {
default = pkgs.mkShell {
name = defaultPackageName;
packages = [ defaultPackage ];
inputsFrom = [ ];
shellHook = ''
'';
};
};
}) // {
# these outputs will be NOT wrapped with ${system}
# this will make an overlay out of each of the packageDefinitions defined above
# and set the default overlay to the one named here.
overlays = utils.makeOverlays luaPath {
inherit nixpkgs dependencyOverlays extra_pkg_config;
} categoryDefinitions packageDefinitions defaultPackageName;
# we also export a nixos module to allow reconfiguration from configuration.nix
nixosModules.default = utils.mkNixosModules {
inherit defaultPackageName dependencyOverlays luaPath
categoryDefinitions packageDefinitions extra_pkg_config nixpkgs;
};
# and the same for home manager
homeModule = utils.mkHomeModules {
inherit defaultPackageName dependencyOverlays luaPath
categoryDefinitions packageDefinitions extra_pkg_config nixpkgs;
};
inherit utils;
inherit (utils) templates;
};
}