diff options
Diffstat (limited to 'usecases')
-rw-r--r-- | usecases/desktop/development.nix | 238 | ||||
-rw-r--r-- | usecases/desktop/development/latex.nix | 11 |
2 files changed, 51 insertions, 198 deletions
diff --git a/usecases/desktop/development.nix b/usecases/desktop/development.nix index 48c4550..4146352 100644 --- a/usecases/desktop/development.nix +++ b/usecases/desktop/development.nix | |||
@@ -1,70 +1,26 @@ | |||
1 | inputs: { | 1 | inputs: |
2 | config, | 2 | { |
3 | lib, | ||
4 | pkgs, | 3 | pkgs, |
5 | ... | 4 | ... |
6 | }: let | 5 | }: |
7 | inherit | 6 | let |
8 | (pkgs.unstable) | 7 | inherit (pkgs.unstable) |
9 | clang | 8 | clang |
10 | clang-tools | 9 | clang-tools |
11 | elixir_ls | ||
12 | haskell-language-server | ||
13 | marksman | ||
14 | nixd | ||
15 | ltex-ls | ||
16 | lua-language-server | ||
17 | typos-lsp | ||
18 | typst-lsp | ||
19 | vimPlugins | ||
20 | ; | 10 | ; |
21 | 11 | in | |
22 | pylsp-env = pkgs.unstable.python3.withPackages (p: | 12 | { |
23 | with p; [ | ||
24 | python-lsp-server | ||
25 | python-lsp-server.passthru.optional-dependencies.rope | ||
26 | python-lsp-ruff | ||
27 | pylsp-rope | ||
28 | ]); | ||
29 | |||
30 | luaFormat = inputs.self.lib.generators.lua {}; | ||
31 | in { | ||
32 | imports = [ | 13 | imports = [ |
33 | (import ./development/adb.nix inputs) | 14 | (import ./development/adb.nix inputs) |
34 | (import ./development/latex.nix inputs) | 15 | (import ./development/latex.nix inputs) |
35 | (import ./development/nixvim-dev.nix inputs) | 16 | (import ./development/nixvim-dev.nix inputs) |
36 | ]; | 17 | ]; |
37 | 18 | ||
38 | options = with lib; | 19 | users.extraUsers.minijackson.packages = |
39 | with luaFormat.lib; { | 20 | [ |
40 | vim.lsp = mkOption { | ||
41 | description = '' | ||
42 | Configure Neovim to use these LSP servers; | ||
43 | ''; | ||
44 | type = with types; | ||
45 | attrsOf (submodule { | ||
46 | freeformType = luaFormat.type; | ||
47 | |||
48 | options = { | ||
49 | capabilities = mkOption { | ||
50 | default = mkRaw "capabilities"; | ||
51 | }; | ||
52 | cmd = mkOption { | ||
53 | type = with types; listOf str; | ||
54 | }; | ||
55 | on_attach = mkOption { | ||
56 | default = mkRaw "on_attach"; | ||
57 | }; | ||
58 | }; | ||
59 | }); | ||
60 | default = {}; | ||
61 | }; | ||
62 | }; | ||
63 | |||
64 | config = { | ||
65 | users.extraUsers.minijackson.packages = [ | ||
66 | pkgs.git-branchless | 21 | pkgs.git-branchless |
67 | ] ++ (with pkgs.unstable; [ | 22 | ] |
23 | ++ (with pkgs.unstable; [ | ||
68 | bintools | 24 | bintools |
69 | clang | 25 | clang |
70 | clang-tools | 26 | clang-tools |
@@ -121,138 +77,47 @@ in { | |||
121 | python3 | 77 | python3 |
122 | ]); | 78 | ]); |
123 | 79 | ||
124 | programs.zsh.interactiveShellInit = '' | 80 | programs.zsh.interactiveShellInit = '' |
125 | (( $+commands[rustc] )) && fpath+="$(rustc --print sysroot)/share/zsh/site-functions" | 81 | (( $+commands[rustc] )) && fpath+="$(rustc --print sysroot)/share/zsh/site-functions" |
126 | source ${../../dotfiles/git-branchless.zsh} | 82 | source ${../../dotfiles/git-branchless.zsh} |
127 | ''; | 83 | ''; |
128 | |||
129 | vim = { | ||
130 | extraPlugins = with vimPlugins; [ | ||
131 | actions-preview-nvim | ||
132 | vim-pandoc | ||
133 | clangd_extensions-nvim | ||
134 | lsp_signature-nvim | ||
135 | neodev-nvim | ||
136 | nvim-lspconfig | ||
137 | playground | ||
138 | vim-grammarous | ||
139 | |||
140 | # DAP | ||
141 | # nvim-dap | ||
142 | # nvim-dap-ui | ||
143 | # nvim-dap-virtual-text | ||
144 | # telescope-dap-nvim | ||
145 | |||
146 | rustaceanvim | ||
147 | ]; | ||
148 | 84 | ||
149 | lsp = { | 85 | programs.liboping.enable = true; |
150 | bashls.cmd = ["${pkgs.unstable.nodePackages.bash-language-server}/bin/bash-language-server" "start"]; | ||
151 | clangd = { | ||
152 | cmd = [ | ||
153 | "${clang-tools}/bin/clangd" | ||
154 | "--background-index" | ||
155 | "--clang-tidy" | ||
156 | "--fallback-style=WebKit" | ||
157 | "--header-insertion-decorators" | ||
158 | "--header-insertion=iwyu" | ||
159 | ]; | ||
160 | capabilities = luaFormat.lib.mkRaw ''vim.tbl_extend("force", capabilities, { offsetEncoding = "utf-8" })''; | ||
161 | }; | ||
162 | elixirls.cmd = ["${elixir_ls}/bin/elixir-ls"]; | ||
163 | hls.cmd = ["${haskell-language-server}/bin/haskell-language-server" "--lsp"]; | ||
164 | ltex = { | ||
165 | cmd = ["${ltex-ls}/bin/ltex-ls"]; | ||
166 | filetypes = [ | ||
167 | "bib" | ||
168 | "gitcommit" | ||
169 | "markdown" | ||
170 | "org" | ||
171 | "plaintex" | ||
172 | "rst" | ||
173 | "rnoweb" | ||
174 | "tex" | ||
175 | "typst" | ||
176 | "pandoc" | ||
177 | "quarto" | ||
178 | "rmd" | ||
179 | "context" | ||
180 | ]; | ||
181 | }; | ||
182 | lua_ls = { | ||
183 | cmd = ["${lua-language-server}/bin/lua-language-server"]; | ||
184 | settings.Lua = { | ||
185 | completion.callSnippet = "Replace"; | ||
186 | telemetry.enable = false; | ||
187 | }; | ||
188 | }; | ||
189 | marksman.cmd = ["${marksman}/bin/marksman"]; | ||
190 | nixd = { | ||
191 | cmd = [(lib.getExe nixd)]; | ||
192 | settings.nixd.formatting.command = ["alejandra"]; | ||
193 | }; | ||
194 | pylsp = { | ||
195 | cmd = ["${pylsp-env}/bin/pylsp"]; | ||
196 | settings.pylsp.plugins.ruff.enabled = true; | ||
197 | }; | ||
198 | taplo.cmd = ["${pkgs.unstable.taplo}/bin/taplo" "lsp" "stdio"]; | ||
199 | typos_lsp.cmd = [(lib.getExe typos-lsp)]; | ||
200 | typst_lsp.cmd = [(lib.getExe typst-lsp)]; | ||
201 | }; | ||
202 | |||
203 | luaConfig = with lib; let | ||
204 | toLua = luaFormat.generate; | ||
205 | lspconfigFor = name: settings: "lspconfig['${name}'].setup ${toLua settings}"; | ||
206 | lspconfig = | ||
207 | concatStringsSep | ||
208 | "\n" | ||
209 | (mapAttrsToList lspconfigFor config.vim.lsp); | ||
210 | in '' | ||
211 | require('vim-dev') | ||
212 | local on_attach = require('myConfig.exports').on_attach | ||
213 | local capabilities = require('myConfig.exports').capabilities | ||
214 | local lspconfig = require('lspconfig') | ||
215 | ${lspconfig} | ||
216 | ''; | ||
217 | }; | ||
218 | 86 | ||
219 | programs.liboping.enable = true; | 87 | documentation.dev.enable = true; |
220 | 88 | ||
221 | documentation.dev.enable = true; | 89 | boot.kernel.sysctl = { |
222 | 90 | # For RR | |
223 | boot.kernel.sysctl = { | 91 | "kernel.perf_event_paranoid" = 1; |
224 | # For RR | 92 | }; |
225 | "kernel.perf_event_paranoid" = 1; | ||
226 | }; | ||
227 | 93 | ||
228 | home-manager.users.minijackson = {config, ...}: { | 94 | home-manager.users.minijackson = |
95 | { config, ... }: | ||
96 | { | ||
229 | home.shellAliases.git = "git-branchless wrap --"; | 97 | home.shellAliases.git = "git-branchless wrap --"; |
230 | 98 | ||
231 | home.file.".clang-format".source = | 99 | home.file.".clang-format".source = (pkgs.formats.yaml { }).generate "clang-format.yml" { |
232 | (pkgs.formats.yaml {}).generate | 100 | BasedOnStyle = "Mozilla"; |
233 | "clang-format.yml" | 101 | ColumnLimit = 100; |
234 | { | 102 | TabWidth = 4; |
235 | BasedOnStyle = "Mozilla"; | 103 | IndentWidth = 4; |
236 | ColumnLimit = 100; | 104 | UseTab = "ForIndentation"; |
237 | TabWidth = 4; | 105 | |
238 | IndentWidth = 4; | 106 | AlignAfterOpenBracket = "AlwaysBreak"; |
239 | UseTab = "ForIndentation"; | 107 | AccessModifierOffset = -4; |
240 | 108 | AlwaysBreakAfterDefinitionReturnType = "None"; | |
241 | AlignAfterOpenBracket = "AlwaysBreak"; | 109 | AlwaysBreakAfterReturnType = "None"; |
242 | AccessModifierOffset = -4; | 110 | AlwaysBreakTemplateDeclarations = true; |
243 | AlwaysBreakAfterDefinitionReturnType = "None"; | 111 | BinPackArguments = false; |
244 | AlwaysBreakAfterReturnType = "None"; | 112 | BinPackParameters = false; |
245 | AlwaysBreakTemplateDeclarations = true; | 113 | BreakConstructorInitializers = "BeforeComma"; |
246 | BinPackArguments = false; | 114 | Cpp11BracedListStyle = true; |
247 | BinPackParameters = false; | 115 | DerivePointerAlignment = false; |
248 | BreakConstructorInitializers = "BeforeComma"; | 116 | NamespaceIndentation = "Inner"; |
249 | Cpp11BracedListStyle = true; | 117 | PenaltyBreakBeforeFirstCallParameter = 2; |
250 | DerivePointerAlignment = false; | 118 | PointerAlignment = "Left"; |
251 | NamespaceIndentation = "Inner"; | 119 | Standard = "Latest"; |
252 | PenaltyBreakBeforeFirstCallParameter = 2; | 120 | }; |
253 | PointerAlignment = "Left"; | ||
254 | Standard = "Latest"; | ||
255 | }; | ||
256 | 121 | ||
257 | programs.direnv = { | 122 | programs.direnv = { |
258 | enable = true; | 123 | enable = true; |
@@ -277,10 +142,9 @@ in { | |||
277 | }; | 142 | }; |
278 | }; | 143 | }; |
279 | 144 | ||
280 | nixpkgs.overlays = [ | 145 | nixpkgs.overlays = [ |
281 | (self: super: { | 146 | (self: super: { |
282 | inherit (self.unstable) nix-direnv direnv; | 147 | inherit (self.unstable) nix-direnv direnv; |
283 | }) | 148 | }) |
284 | ]; | 149 | ]; |
285 | }; | ||
286 | } | 150 | } |
diff --git a/usecases/desktop/development/latex.nix b/usecases/desktop/development/latex.nix index e264e9e..a04a157 100644 --- a/usecases/desktop/development/latex.nix +++ b/usecases/desktop/development/latex.nix | |||
@@ -117,15 +117,4 @@ in | |||
117 | 117 | ||
118 | # Fira Code is nice for code reading | 118 | # Fira Code is nice for code reading |
119 | fonts.packages = with pkgs; [ fira-code cm_unicode ]; | 119 | fonts.packages = with pkgs; [ fira-code cm_unicode ]; |
120 | |||
121 | vim = { | ||
122 | lsp.texlab = { | ||
123 | cmd = [ "${pkgs.unstable.texlab}/bin/texlab" ]; | ||
124 | settings.texlab.build = { | ||
125 | executable = "${texliveEnv}/bin/latexmk"; | ||
126 | args = [ "-synctex=1" "-interaction=nonstopmode" "-shell-escape" "-use-make" "-8bit" "-xelatex" "-output-directory=latexmk-build" "%f" ]; | ||
127 | auxDirectory = [ "latexmk-build" ]; | ||
128 | }; | ||
129 | }; | ||
130 | }; | ||
131 | } | 120 | } |