From 2122a01f99c6da466b8f0f55c965c11a9043d117 Mon Sep 17 00:00:00 2001 From: Benedikt Peetz Date: Sat, 9 Nov 2024 12:35:44 +0100 Subject: refactor(modules/legacy/conf/nvim): Move to `by-name` --- .../by-name/nv/nvim/plgs/lsp/servers/default.nix | 15 ++++++++ .../nv/nvim/plgs/lsp/servers/servers/bashls.nix | 11 ++++++ .../nv/nvim/plgs/lsp/servers/servers/ccls.nix | 11 ++++++ .../nv/nvim/plgs/lsp/servers/servers/ltex.nix | 45 ++++++++++++++++++++++ .../nv/nvim/plgs/lsp/servers/servers/lua-ls.nix | 14 +++++++ .../nv/nvim/plgs/lsp/servers/servers/nil-ls.nix | 16 ++++++++ .../nv/nvim/plgs/lsp/servers/servers/openscad.nix | 24 ++++++++++++ .../nv/nvim/plgs/lsp/servers/servers/pylyzer.nix | 19 +++++++++ .../plgs/lsp/servers/servers/quick-lint-js.nix | 22 +++++++++++ .../nv/nvim/plgs/lsp/servers/servers/ruff-lsp.nix | 17 ++++++++ .../plgs/lsp/servers/servers/rust-analyzer.nix | 23 +++++++++++ .../nv/nvim/plgs/lsp/servers/servers/texlab.nix | 13 +++++++ 12 files changed, 230 insertions(+) create mode 100644 modules/by-name/nv/nvim/plgs/lsp/servers/default.nix create mode 100644 modules/by-name/nv/nvim/plgs/lsp/servers/servers/bashls.nix create mode 100644 modules/by-name/nv/nvim/plgs/lsp/servers/servers/ccls.nix create mode 100644 modules/by-name/nv/nvim/plgs/lsp/servers/servers/ltex.nix create mode 100644 modules/by-name/nv/nvim/plgs/lsp/servers/servers/lua-ls.nix create mode 100644 modules/by-name/nv/nvim/plgs/lsp/servers/servers/nil-ls.nix create mode 100644 modules/by-name/nv/nvim/plgs/lsp/servers/servers/openscad.nix create mode 100644 modules/by-name/nv/nvim/plgs/lsp/servers/servers/pylyzer.nix create mode 100644 modules/by-name/nv/nvim/plgs/lsp/servers/servers/quick-lint-js.nix create mode 100644 modules/by-name/nv/nvim/plgs/lsp/servers/servers/ruff-lsp.nix create mode 100644 modules/by-name/nv/nvim/plgs/lsp/servers/servers/rust-analyzer.nix create mode 100644 modules/by-name/nv/nvim/plgs/lsp/servers/servers/texlab.nix (limited to 'modules/by-name/nv/nvim/plgs/lsp/servers') diff --git a/modules/by-name/nv/nvim/plgs/lsp/servers/default.nix b/modules/by-name/nv/nvim/plgs/lsp/servers/default.nix new file mode 100644 index 00000000..605046d4 --- /dev/null +++ b/modules/by-name/nv/nvim/plgs/lsp/servers/default.nix @@ -0,0 +1,15 @@ +{...}: { + imports = [ + # ./servers/pylyzer.nix + ./servers/bashls.nix + ./servers/ccls.nix + ./servers/quick-lint-js.nix + ./servers/ltex.nix + ./servers/lua-ls.nix + ./servers/nil-ls.nix + ./servers/openscad.nix + ./servers/ruff-lsp.nix + ./servers/rust-analyzer.nix + ./servers/texlab.nix + ]; +} diff --git a/modules/by-name/nv/nvim/plgs/lsp/servers/servers/bashls.nix b/modules/by-name/nv/nvim/plgs/lsp/servers/servers/bashls.nix new file mode 100644 index 00000000..7d036a13 --- /dev/null +++ b/modules/by-name/nv/nvim/plgs/lsp/servers/servers/bashls.nix @@ -0,0 +1,11 @@ +{ + lib, + config, + ... +}: let + cfg = config.soispha.programs.nvim; +in { + home-manager.users.soispha.programs.nixvim.plugins.lsp.servers = lib.mkIf cfg.enable { + bashls.enable = true; + }; +} diff --git a/modules/by-name/nv/nvim/plgs/lsp/servers/servers/ccls.nix b/modules/by-name/nv/nvim/plgs/lsp/servers/servers/ccls.nix new file mode 100644 index 00000000..cd7229bc --- /dev/null +++ b/modules/by-name/nv/nvim/plgs/lsp/servers/servers/ccls.nix @@ -0,0 +1,11 @@ +{ + config, + lib, + ... +}: let + cfg = config.soispha.programs.nvim; +in { + home-manager.users.soispha.programs.nixvim.plugins.lsp.servers = lib.mkIf cfg.enable { + ccls.enable = true; + }; +} diff --git a/modules/by-name/nv/nvim/plgs/lsp/servers/servers/ltex.nix b/modules/by-name/nv/nvim/plgs/lsp/servers/servers/ltex.nix new file mode 100644 index 00000000..c89e0790 --- /dev/null +++ b/modules/by-name/nv/nvim/plgs/lsp/servers/servers/ltex.nix @@ -0,0 +1,45 @@ +{ + config, + lib, + ... +}: let + cfg = config.soispha.programs.nvim; +in { + home-manager.users.soispha.programs.nixvim.plugins.lsp.servers = lib.mkIf cfg.enable { + ltex = let + filetypes = [ + "java" + "cpp" + "shell" + "bash" + + "bibtex" + "context" + "context.tex" + "latex" + "tex" + + "markdown" + "org" + "restructuredtext" + "rsweave" + + "git-commit" + "gitcommit" + + "mail" + ]; + in { + enable = true; + inherit filetypes; + settings = { + enabled = filetypes; + completionEnabled = false; + language = "en-CA"; + additionalRules = { + enablePickyRules = true; + }; + }; + }; + }; +} diff --git a/modules/by-name/nv/nvim/plgs/lsp/servers/servers/lua-ls.nix b/modules/by-name/nv/nvim/plgs/lsp/servers/servers/lua-ls.nix new file mode 100644 index 00000000..f2e553f1 --- /dev/null +++ b/modules/by-name/nv/nvim/plgs/lsp/servers/servers/lua-ls.nix @@ -0,0 +1,14 @@ +{ + config, + lib, + ... +}: let + cfg = config.soispha.programs.nvim; +in { + home-manager.users.soispha.programs.nixvim.plugins.lsp.servers = lib.mkIf cfg.enable { + lua_ls = { + enable = true; + settings.telemetry.enable = false; + }; + }; +} diff --git a/modules/by-name/nv/nvim/plgs/lsp/servers/servers/nil-ls.nix b/modules/by-name/nv/nvim/plgs/lsp/servers/servers/nil-ls.nix new file mode 100644 index 00000000..9c760345 --- /dev/null +++ b/modules/by-name/nv/nvim/plgs/lsp/servers/servers/nil-ls.nix @@ -0,0 +1,16 @@ +{ + config, + lib, + ... +}: let + cfg = config.soispha.programs.nvim; +in { + home-manager.users.soispha.programs.nixvim.plugins.lsp.servers = lib.mkIf cfg.enable { + nil_ls = { + enable = true; + settings = { + formatting.command = ["alejandra"]; + }; + }; + }; +} diff --git a/modules/by-name/nv/nvim/plgs/lsp/servers/servers/openscad.nix b/modules/by-name/nv/nvim/plgs/lsp/servers/servers/openscad.nix new file mode 100644 index 00000000..94f7b067 --- /dev/null +++ b/modules/by-name/nv/nvim/plgs/lsp/servers/servers/openscad.nix @@ -0,0 +1,24 @@ +{ + config, + lib, + pkgs, + ... +}: let + cfg = config.soispha.programs.nvim; +in { + home-manager.users.soispha.programs.nixvim = lib.mkIf cfg.enable { + extraConfigLuaPost = + /* + lua + */ + '' + require('lspconfig').openscad_lsp.setup{ + cmd = {"openscad-lsp", "--stdio", "--fmt-style", "WebKit"}, + } + ''; + extraPackages = with pkgs; [ + openscad-lsp + clang-tools # Need to satisfy `clang-format` (which is used by openscad-lsp) + ]; + }; +} diff --git a/modules/by-name/nv/nvim/plgs/lsp/servers/servers/pylyzer.nix b/modules/by-name/nv/nvim/plgs/lsp/servers/servers/pylyzer.nix new file mode 100644 index 00000000..3ac66102 --- /dev/null +++ b/modules/by-name/nv/nvim/plgs/lsp/servers/servers/pylyzer.nix @@ -0,0 +1,19 @@ +{ + config, + lib, + pkgs, + ... +}: let + cfg = config.soispha.programs.nvim; +in { + home-manager.users.soispha.programs.nixvim = lib.mkIf cfg.enable { + extraConfigLuaPost = + /* + lua + */ + '' + require('lspconfig').pylyzer.setup{} + ''; + extraPackages = with pkgs; [pylyzer]; + }; +} diff --git a/modules/by-name/nv/nvim/plgs/lsp/servers/servers/quick-lint-js.nix b/modules/by-name/nv/nvim/plgs/lsp/servers/servers/quick-lint-js.nix new file mode 100644 index 00000000..48a3a71c --- /dev/null +++ b/modules/by-name/nv/nvim/plgs/lsp/servers/servers/quick-lint-js.nix @@ -0,0 +1,22 @@ +{ + config, + lib, + pkgs, + ... +}: let + cfg = config.soispha.programs.nvim; +in { + home-manager.users.soispha.programs.nixvim = lib.mkIf cfg.enable { + extraConfigLuaPost = + /* + lua + */ + '' + require('lspconfig').quick_lint_js.setup{ + } + ''; + extraPackages = with pkgs; [ + quick-lint-js + ]; + }; +} diff --git a/modules/by-name/nv/nvim/plgs/lsp/servers/servers/ruff-lsp.nix b/modules/by-name/nv/nvim/plgs/lsp/servers/servers/ruff-lsp.nix new file mode 100644 index 00000000..41b3118a --- /dev/null +++ b/modules/by-name/nv/nvim/plgs/lsp/servers/servers/ruff-lsp.nix @@ -0,0 +1,17 @@ +{ + pkgs, + config, + lib, + ... +}: let + cfg = config.soispha.programs.nvim; +in { + home-manager.users.soispha.programs.nixvim = lib.mkIf cfg.enable { + plugins.lsp.servers = { + ruff_lsp = { + enable = true; + }; + }; + extraPackages = with pkgs; [ruff]; + }; +} diff --git a/modules/by-name/nv/nvim/plgs/lsp/servers/servers/rust-analyzer.nix b/modules/by-name/nv/nvim/plgs/lsp/servers/servers/rust-analyzer.nix new file mode 100644 index 00000000..01cd11f4 --- /dev/null +++ b/modules/by-name/nv/nvim/plgs/lsp/servers/servers/rust-analyzer.nix @@ -0,0 +1,23 @@ +{ + config, + lib, + ... +}: let + cfg = config.soispha.programs.nvim; +in { + home-manager.users.soispha.programs.nixvim.plugins.lsp.servers = lib.mkIf cfg.enable { + rust_analyzer = { + enable = true; + settings = { + typing.autoClosingAngleBrackets.enable = true; + + # Check with `cargo clippy` instead of just `cargo check` + check.command = "clippy"; + }; + # NOTE: These should be provided by the devenv, to support nightly and + # such things <2023-11-25> + installCargo = false; + installRustc = false; + }; + }; +} diff --git a/modules/by-name/nv/nvim/plgs/lsp/servers/servers/texlab.nix b/modules/by-name/nv/nvim/plgs/lsp/servers/servers/texlab.nix new file mode 100644 index 00000000..3f91beb5 --- /dev/null +++ b/modules/by-name/nv/nvim/plgs/lsp/servers/servers/texlab.nix @@ -0,0 +1,13 @@ +{ + config, + lib, + ... +}: let + cfg = config.soispha.programs.nvim; +in { + home-manager.users.soispha.programs.nixvim.plugins.lsp.servers = lib.mkIf cfg.enable { + texlab = { + enable = true; + }; + }; +} -- cgit 1.4.1