summaryrefslogtreecommitdiffstats
path: root/usecases
diff options
context:
space:
mode:
authorMinijackson <minijackson@riseup.net>2023-03-11 16:29:57 +0100
committerMinijackson <minijackson@riseup.net>2023-03-11 16:30:50 +0100
commita9bf27f1ec2ff4b53937ef6971f8395d3d9c5b2a (patch)
tree92883eef0a909a223bf2561efcf5e79d9f4bd3cb /usecases
parente16276096717b970dadebb3dcd2701b894f00728 (diff)
downloadnixos-config-reborn-a9bf27f1ec2ff4b53937ef6971f8395d3d9c5b2a.tar.gz
nixos-config-reborn-a9bf27f1ec2ff4b53937ef6971f8395d3d9c5b2a.zip
development: additional tools
Diffstat (limited to 'usecases')
-rw-r--r--usecases/desktop/development.nix229
1 files changed, 131 insertions, 98 deletions
diff --git a/usecases/desktop/development.nix b/usecases/desktop/development.nix
index d15afec..bc936b8 100644
--- a/usecases/desktop/development.nix
+++ b/usecases/desktop/development.nix
@@ -1,9 +1,11 @@
1inputs: 1inputs: {
2 2 config,
3{ config, lib, pkgs, ... }: 3 lib,
4 4 pkgs,
5let 5 ...
6 inherit (pkgs.unstable) 6}: let
7 inherit
8 (pkgs.unstable)
7 clang 9 clang
8 clang-tools 10 clang-tools
9 elixir_ls 11 elixir_ls
@@ -11,67 +13,82 @@ let
11 marksman 13 marksman
12 rust-analyzer-unwrapped 14 rust-analyzer-unwrapped
13 lua-language-server 15 lua-language-server
14 16 vimPlugins
15 vimPlugins; 17 ;
16 18
17 inherit (pkgs.unstable.python3Packages) python-lsp-server; 19 pylsp = with pkgs.unstable.python3Packages;
18 20 python-lsp-server.overrideAttrs (old: {
19 luaFormat = inputs.self.lib.generators.lua { }; 21 propagatedBuildInputs =
20 22 old.propagatedBuildInputs
21in 23 ++ python-lsp-server.passthru.optional-dependencies.all;
22{ 24 });
25
26 luaFormat = inputs.self.lib.generators.lua {};
27in {
23 imports = [ 28 imports = [
24 (import ./development/latex.nix inputs) 29 (import ./development/latex.nix inputs)
25 ]; 30 ];
26 31
27 options = with lib; with luaFormat.lib; { 32 options = with lib;
33 with luaFormat.lib; {
28 vim.lsp = mkOption { 34 vim.lsp = mkOption {
29 description = '' 35 description = ''
30 Configure Neovim to use these LSP servers; 36 Configure Neovim to use these LSP servers;
31 ''; 37 '';
32 type = with types; attrsOf (submodule { 38 type = with types;
33 freeformType = luaFormat.type; 39 attrsOf (submodule {
34 40 freeformType = luaFormat.type;
35 options = { 41
36 capabilities = mkOption { 42 options = {
37 default = mkRaw "capabilities"; 43 capabilities = mkOption {
38 }; 44 default = mkRaw "capabilities";
39 cmd = mkOption { 45 };
40 type = with types; listOf str; 46 cmd = mkOption {
41 }; 47 type = with types; listOf str;
42 on_attach = mkOption { 48 };
43 default = mkRaw "on_attach"; 49 on_attach = mkOption {
50 default = mkRaw "on_attach";
51 };
44 }; 52 };
45 }; 53 });
46 }); 54 default = {};
47 default = { };
48 }; 55 };
49 }; 56 };
50 57
51 config = { 58 config = {
52 # TODO: add cargo-info 59 # TODO: add cargo-info
53 users.extraUsers.minijackson.packages = with pkgs.unstable; [ 60 users.extraUsers.minijackson.packages = with pkgs.unstable;
54 bintools 61 [
55 bacon 62 bintools
56 clang 63 bacon
57 clang-tools 64 clang
58 diffoscopeMinimal 65 clang-tools
59 elixir 66 diffoscopeMinimal
60 gcc 67 elixir
61 gdb 68 gcc
62 graphviz 69 gdb
63 man-pages 70 graphviz
64 python3Packages.ipython 71 man-pages
65 rr 72 python3Packages.ipython
66 rustup 73 rr
67 watchexec 74 rustup
68 75 watchexec
69 # Python 76
70 black 77 shfmt
71 python3Packages.isort 78 taplo
72 python3Packages.mypy 79
73 python3Packages.tox 80 # Python
74 ]; 81 black
82 python3Packages.isort
83 python3Packages.mypy
84 python3Packages.tox
85 # TODO: how to install into pylsp's python env?
86 # python-lsp-black
87 # pyls-isort
88 # pylsp-mypy
89
90 ruff
91 ];
75 92
76 vim = { 93 vim = {
77 extraPlugins = with vimPlugins; [ 94 extraPlugins = with vimPlugins; [
@@ -91,28 +108,45 @@ in
91 }; 108 };
92 109
93 lsp = { 110 lsp = {
94 elixirls.cmd = [ "${elixir_ls}/bin/elixir-ls" ]; 111 elixirls.cmd = ["${elixir_ls}/bin/elixir-ls"];
95 hls.cmd = [ "${haskell-language-server}/bin/haskell-language-server" "--lsp" ]; 112 hls.cmd = ["${haskell-language-server}/bin/haskell-language-server" "--lsp"];
96 lua_ls = { 113 lua_ls = {
97 cmd = [ "${lua-language-server}/bin/lua-language-server" ]; 114 cmd = ["${lua-language-server}/bin/lua-language-server"];
98 settings.Lua.completion.callSnippet = "Replace"; 115 settings.Lua = {
116 completion.callSnippet = "Replace";
117 telemetry.enable = false;
118 };
119 };
120 marksman.cmd = ["${marksman}/bin/marksman"];
121 pylsp = {
122 cmd = ["${pylsp}/bin/pylsp"];
123 settings.pylsp.plugins = {
124 autopep8.enabled = false;
125 flake8.ignore = ["E501"];
126 pycodestyle.ignore = ["E501"];
127 yapf.enabled = false;
128
129 # See TODO above
130 #black.enabled = true;
131 #isort.enabled = true;
132 #mypy.enabled = true;
133 };
99 }; 134 };
100 marksman.cmd = [ "${marksman}/bin/marksman" ];
101 pylsp.cmd = [ "${python-lsp-server}/bin/pylsp" ];
102 }; 135 };
103 136
104 luaConfig = with lib; let 137 luaConfig = with lib; let
105 toLua = luaFormat.generate; 138 toLua = luaFormat.generate;
106 lspconfigFor = name: settings: "lspconfig['${name}'].setup ${toLua settings}"; 139 lspconfigFor = name: settings: "lspconfig['${name}'].setup ${toLua settings}";
107 lspconfig = concatStringsSep 140 lspconfig =
141 concatStringsSep
108 "\n" 142 "\n"
109 (mapAttrsToList lspconfigFor config.vim.lsp); 143 (mapAttrsToList lspconfigFor config.vim.lsp);
110 in 144 in
111 mkMerge [ 145 mkMerge [
112 "require('vim-dev')" 146 "require('vim-dev')"
113 "local lspconfig = require('lspconfig')" 147 "local lspconfig = require('lspconfig')"
114 lspconfig 148 lspconfig
115 ]; 149 ];
116 }; 150 };
117 151
118 programs.zsh.interactiveShellInit = '' 152 programs.zsh.interactiveShellInit = ''
@@ -128,47 +162,46 @@ in
128 "kernel.perf_event_paranoid" = 1; 162 "kernel.perf_event_paranoid" = 1;
129 }; 163 };
130 164
131 home-manager.users.minijackson = { config, ... }: 165 home-manager.users.minijackson = {config, ...}: {
132 { 166 home.file.".clang-format".source =
133 home.file.".clang-format".source = (pkgs.formats.yaml { }).generate 167 (pkgs.formats.yaml {}).generate
134 "clang-format.yml" 168 "clang-format.yml"
135 { 169 {
136 BasedOnStyle = "Mozilla"; 170 BasedOnStyle = "Mozilla";
137 ColumnLimit = 100; 171 ColumnLimit = 100;
138 TabWidth = 4; 172 TabWidth = 4;
139 IndentWidth = 4; 173 IndentWidth = 4;
140 UseTab = "ForIndentation"; 174 UseTab = "ForIndentation";
141 175
142 AlignAfterOpenBracket = "AlwaysBreak"; 176 AlignAfterOpenBracket = "AlwaysBreak";
143 AccessModifierOffset = -4; 177 AccessModifierOffset = -4;
144 AlwaysBreakAfterDefinitionReturnType = "None"; 178 AlwaysBreakAfterDefinitionReturnType = "None";
145 AlwaysBreakAfterReturnType = "None"; 179 AlwaysBreakAfterReturnType = "None";
146 AlwaysBreakTemplateDeclarations = true; 180 AlwaysBreakTemplateDeclarations = true;
147 BinPackArguments = false; 181 BinPackArguments = false;
148 BinPackParameters = false; 182 BinPackParameters = false;
149 BreakConstructorInitializers = "BeforeComma"; 183 BreakConstructorInitializers = "BeforeComma";
150 Cpp11BracedListStyle = true; 184 Cpp11BracedListStyle = true;
151 DerivePointerAlignment = false; 185 DerivePointerAlignment = false;
152 NamespaceIndentation = "Inner"; 186 NamespaceIndentation = "Inner";
153 PenaltyBreakBeforeFirstCallParameter = 2; 187 PenaltyBreakBeforeFirstCallParameter = 2;
154 PointerAlignment = "Left"; 188 PointerAlignment = "Left";
155 Standard = "Latest"; 189 Standard = "Latest";
156 }; 190 };
157 191
158 programs.direnv = { 192 programs.direnv = {
159 enable = true; 193 enable = true;
160 enableBashIntegration = true; 194 enableBashIntegration = true;
161 enableZshIntegration = true; 195 enableZshIntegration = true;
162 196
163 nix-direnv.enable = true; 197 nix-direnv.enable = true;
164 };
165 }; 198 };
199 };
166 200
167 nixpkgs.overlays = [ 201 nixpkgs.overlays = [
168 (self: super: { 202 (self: super: {
169 inherit (self.unstable) nix-direnv direnv; 203 inherit (self.unstable) nix-direnv direnv;
170 }) 204 })
171 ]; 205 ];
172
173 }; 206 };
174} 207}