-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake-old.nix
261 lines (227 loc) · 6.92 KB
/
flake-old.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
{
description = "polarmutex's NeoVim config";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
neovim = {
url = "github:neovim/neovim?dir=contrib";
inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-utils.follows = "flake-utils";
};
nix2vim = {
url = "github:gytis-ivaskevicius/nix2vim";
inputs.nixpkgs.follows = "nixpkgs";
};
DSL = {
url = "github:DieracDelta/nix2lua/aarch64-darwin";
inputs.neovim.follows = "neovim";
inputs.nixpkgs.follows = "nixpkgs";
};
# LSP
rnix-lsp = {
url = "github:Ma27/rnix-lsp?ref=01b3623b49284d87a034676d3f4b298e495190dd";
inputs.nixpkgs.follows = "nixpkgs";
};
# Plugins
beancount = {
url = "github:polarmutex/beancount.nvim";
flake = false;
};
blamer-nvim-src = {
url = "github:APZelos/blamer.nvim";
flake = false;
};
cmp-src = {
url = "github:hrsh7th/nvim-cmp";
flake = false;
};
cmp-nvim-lsp-src = {
url = "github:hrsh7th/cmp-nvim-lsp";
flake = false;
};
cmp-buffer-src = {
url = "github:hrsh7th/cmp-buffer";
flake = false;
};
colorizer-src = {
url = "github:powerman/vim-plugin-AnsiEsc";
flake = false;
};
comment-nvim-src = {
url = "github:numToStr/Comment.nvim";
flake = false;
};
fidget-src = {
url = "github:j-hui/fidget.nvim";
flake = false;
};
rust-tools-src = {
url = "github:simrat39/rust-tools.nvim";
flake = false;
};
telescope-src = {
url = "github:nvim-telescope/telescope.nvim";
flake = false;
};
telescope-ui-select-src = {
url = "github:nvim-telescope/telescope-ui-select.nvim";
flake = false;
};
which-key-src = {
url = "github:folke/which-key.nvim?ref=bd4411a2ed4dd8bb69c125e339d837028a6eea71";
flake = false;
};
};
outputs = inputs @ {
self,
nixpkgs,
flake-utils,
neovim,
nix2vim,
DSL,
comment-nvim-src,
telescope-ui-select-src,
rust-tools-src,
which-key-src,
fidget-src,
colorizer-src,
...
}: let
# Function to override the source of a package
withSrc = pkg: src: pkg.overrideAttrs (_: {inherit src;});
# Vim2Nix DSL
dsl = nix2vim.lib.dsl;
overlay = prev: final: rec {
luaConfigBuilder = import ./lib/lua-config-builder.nix {
pkgs = prev;
lib = prev.lib;
};
comment-nvim = prev.vimUtils.buildVimPluginFrom2Nix {
pname = "comment-nvim";
version = "nixpkgs";
src = comment-nvim-src;
};
parinfer-rust-nvim = prev.vimUtils.buildVimPluginFrom2Nix {
pname = "parinfer-rust";
version = "nixpkgs";
src = prev.pkgs.parinfer-rust;
};
rust-tools = prev.vimUtils.buildVimPluginFrom2Nix {
pname = "rust-tools";
version = "nixpkgs";
src = rust-tools-src;
};
fidget = prev.vimUtils.buildVimPluginFrom2Nix {
pname = "fidget";
version = "nixpkgs";
src = fidget-src;
};
which-key = prev.vimUtils.buildVimPluginFrom2Nix {
pname = "which-key";
version = "nixpkgs";
src = which-key-src;
};
colorizer = prev.vimUtils.buildVimPluginFrom2Nix {
pname = "colorizer";
version = "nixpkgs";
src = colorizer-src;
};
# Generate our init.lua from neoConfig using vim2nix transpiler
neovimConfig = let
luaConfig = prev.luaConfigBuilder {
config = import ./neoConfig.nix {
inherit (nix2vim.lib) dsl;
pkgs = prev;
};
};
in
prev.writeText "init.lua" luaConfig.lua;
# shamelessly copied from fufexan (thanks buddy!)
# Building neovim package with dependencies and custom config
customNeovim =
(DSL.DSL prev).neovimBuilderWithDeps.legacyWrapper
neovim.defaultPackage.${prev.system}
{
# Dependencies to be prepended to PATH env variable at runtime. Needed by plugins at runtime.
extraRuntimeDeps = with prev; [
# master.clang-tools # fix headers not found
clang # LSP and compiler
fd # telescope file browser
ripgrep # telescope
nodePackages.vscode-json-languageserver # json
pyright
inputs.rnix-lsp.defaultPackage.${prev.system} # nix
];
# Build with NodeJS
withNodeJs = true;
# Passing in raw lua config
configure.customRC = ''
colorscheme dracula
luafile ${neovimConfig}
'';
configure.packages.myVimPackage.start = with nixpkgs.legacyPackages.${prev.system}.vimPlugins; [
# Adding reference to our custom plugin
# for themeing
# commenting with treesiter
comment-nvim
# Overwriting plugin sources with different version
# fuzzy finder
(withSrc telescope-nvim inputs.telescope-src)
(withSrc cmp-buffer inputs.cmp-buffer-src)
(withSrc nvim-cmp inputs.cmp-src)
(withSrc cmp-nvim-lsp inputs.cmp-nvim-lsp-src)
# Plugins from nixpkgs
lsp_signature-nvim
lspkind-nvim
nvim-lspconfig
plenary-nvim
popup-nvim
# which method am I on
nvim-treesitter-context
# FIXME figure out how to configure this one
harpoon
which-key
neogit
#blamer-nvim
parinfer-rust-nvim
#nixpkgs.legacyPackages.${prev.system}.vimPlugins.telescope-file-browser-nvim
# sexy dropdown
#telescope-ui-select
# more lsp rust functionality
rust-tools
# for updating rust crates
crates-nvim
# for showing lsp progress
fidget
# for showing ansi escape sequences
colorizer
# concealer
# conceal # conflicts with treesitter
# Compile syntaxes into treesitter
(prev.vimPlugins.nvim-treesitter.withPlugins
(plugins: with plugins; [tree-sitter-nix tree-sitter-rust tree-sitter-json tree-sitter-c tree-sitter-go]))
];
};
};
in
flake-utils.lib.eachDefaultSystem
(system: let
pkgs = import nixpkgs {
inherit system;
overlays = [nix2vim.overlay overlay];
config = {
allowAliases = false;
};
};
in {
# The packages: our custom neovim and the config text file
packages = {inherit (pkgs) customNeovim neovimConfig;};
# The package built by `nix build .`
defaultPackage = pkgs.customNeovim;
# The app run by `nix run .`
defaultApp = {
type = "app";
program = "${pkgs.customNeovim}/bin/nvim";
};
});
}