blob: f704f0af9aa57f2da70cf543a29656a8ab317bd8 (
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
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
|
inputs: {
config,
lib,
pkgs,
...
}: let
inherit
(pkgs.unstable)
clang
clang-tools
elixir_ls
haskell-language-server
marksman
nil
ltex-ls
lua-language-server
typos-lsp
typst-lsp
vimPlugins
;
pylsp-env = pkgs.unstable.python3.withPackages (p:
with p; [
python-lsp-server
python-lsp-server.passthru.optional-dependencies.rope
python-lsp-ruff
pylsp-rope
]);
luaFormat = inputs.self.lib.generators.lua {};
in {
imports = [
(import ./development/latex.nix inputs)
(import ./development/adb.nix inputs)
];
options = with lib;
with luaFormat.lib; {
vim.lsp = mkOption {
description = ''
Configure Neovim to use these LSP servers;
'';
type = with types;
attrsOf (submodule {
freeformType = luaFormat.type;
options = {
capabilities = mkOption {
default = mkRaw "capabilities";
};
cmd = mkOption {
type = with types; listOf str;
};
on_attach = mkOption {
default = mkRaw "on_attach";
};
};
});
default = {};
};
};
config = {
users.extraUsers.minijackson.packages = with pkgs.unstable; [
bintools
clang
clang-tools
delta
diffoscopeMinimal
difftastic
elixir
gcc
gdb
graphviz
hyperfine
man-pages
nix-output-monitor
python3Packages.ipython
rr
watchexec
xh
shfmt
taplo
# Rust dev
bacon
cargo-info
rustup
lldb
# Python
python3Packages.tox
ruff
neovide
deadnix
nix-init
nix-top
nixpkgs-fmt
nixpkgs-hammering
statix
# TODO: add global vale config
vale
];
vim = {
extraPlugins = with vimPlugins; [
actions-preview-nvim
vim-pandoc
clangd_extensions-nvim
lsp_signature-nvim
neodev-nvim
nvim-lspconfig
playground
vim-grammarous
# DAP
nvim-dap
nvim-dap-ui
nvim-dap-virtual-text
telescope-dap-nvim
rustaceanvim
];
lsp = {
bashls.cmd = ["${pkgs.unstable.nodePackages.bash-language-server}/bin/bash-language-server" "start"];
clangd = {
cmd = [
"${clang-tools}/bin/clangd"
"--background-index"
"--clang-tidy"
"--fallback-style=WebKit"
"--header-insertion-decorators"
"--header-insertion=iwyu"
];
capabilities = luaFormat.lib.mkRaw ''vim.tbl_extend("force", capabilities, { offsetEncoding = "utf-8" })'';
};
elixirls.cmd = ["${elixir_ls}/bin/elixir-ls"];
hls.cmd = ["${haskell-language-server}/bin/haskell-language-server" "--lsp"];
ltex = {
cmd = ["${ltex-ls}/bin/ltex-ls"];
filetypes = [
"bib"
"gitcommit"
"markdown"
"org"
"plaintex"
"rst"
"rnoweb"
"tex"
"typst"
"pandoc"
"quarto"
"rmd"
"context"
"html"
"xhtml"
];
};
lua_ls = {
cmd = ["${lua-language-server}/bin/lua-language-server"];
settings.Lua = {
completion.callSnippet = "Replace";
telemetry.enable = false;
};
};
marksman.cmd = ["${marksman}/bin/marksman"];
# TODO: replace with nixd?
nil_ls.cmd = ["${nil}/bin/nil"];
pylsp = {
cmd = ["${pylsp-env}/bin/pylsp"];
settings.pylsp.plugins.ruff.enabled = true;
};
taplo.cmd = ["${pkgs.unstable.taplo}/bin/taplo" "lsp" "stdio"];
typos_lsp.cmd = [(lib.getExe typos-lsp)];
typst_lsp.cmd = [(lib.getExe typst-lsp)];
};
luaConfig = with lib; let
toLua = luaFormat.generate;
lspconfigFor = name: settings: "lspconfig['${name}'].setup ${toLua settings}";
lspconfig =
concatStringsSep
"\n"
(mapAttrsToList lspconfigFor config.vim.lsp);
in ''
require('vim-dev')
local on_attach = require('myConfig.exports').on_attach
local capabilities = require('myConfig.exports').capabilities
local lspconfig = require('lspconfig')
${lspconfig}
'';
};
programs.zsh.interactiveShellInit = ''
(( $+commands[rustc] )) && fpath+="$(rustc --print sysroot)/share/zsh/site-functions"
'';
programs.liboping.enable = true;
documentation.dev.enable = true;
boot.kernel.sysctl = {
# For RR
"kernel.perf_event_paranoid" = 1;
};
home-manager.users.minijackson = {config, ...}: {
home.file.".clang-format".source =
(pkgs.formats.yaml {}).generate
"clang-format.yml"
{
BasedOnStyle = "Mozilla";
ColumnLimit = 100;
TabWidth = 4;
IndentWidth = 4;
UseTab = "ForIndentation";
AlignAfterOpenBracket = "AlwaysBreak";
AccessModifierOffset = -4;
AlwaysBreakAfterDefinitionReturnType = "None";
AlwaysBreakAfterReturnType = "None";
AlwaysBreakTemplateDeclarations = true;
BinPackArguments = false;
BinPackParameters = false;
BreakConstructorInitializers = "BeforeComma";
Cpp11BracedListStyle = true;
DerivePointerAlignment = false;
NamespaceIndentation = "Inner";
PenaltyBreakBeforeFirstCallParameter = 2;
PointerAlignment = "Left";
Standard = "Latest";
};
programs.direnv = {
enable = true;
enableBashIntegration = true;
enableZshIntegration = true;
nix-direnv.enable = true;
};
home.sessionVariables = {
MIX_XDG = "1";
RUSTUP_HOME = "${config.xdg.dataHome}/rustup";
CARGO_HOME = "${config.xdg.dataHome}/cargo";
RUFF_CACHE_DIR = "${config.xdg.cacheHome}/ruff";
PYTHONPYCACHEPREFIX = "${config.xdg.cacheHome}/python";
PYTHONUSERBASE = "${config.xdg.dataHome}/python";
_JAVA_OPTIONS = "-Djava.util.prefs.userRoot=${config.xdg.configHome}/java";
};
};
nixpkgs.overlays = [
(self: super: {
inherit (self.unstable) nix-direnv direnv;
})
];
};
}
|