diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 328c5ef..a23f16e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -53,9 +53,9 @@ jobs: # bundle to read $KAPI_VIM_LANGS) is applied uniformly -- it's a no-op for # the lite entries, which never call builtins.getEnv. # - # packages.default (the full, every-language experience) is intentionally - # not built here -- that's slow (10+ minutes cold, no caching) and belongs - # in a separate, less-frequent workflow, not this one. + # packages.default (editor-wide tooling, per-language toolchains off) is + # intentionally not built here -- it belongs in a separate, less-frequent + # workflow, not this one. # # Restores every lazy.nvim plugin over the network to the exact commit # recorded in lazy-lock.json (mason is disabled for LSP servers, but diff --git a/README.md b/README.md index 38b39ff..e86154f 100644 --- a/README.md +++ b/README.md @@ -15,3 +15,12 @@ https://github.com/potsrevennil/kapi-vim/blob/702ba0e14e0776db24d08924b2695d4d8c - `nix build github:potsrevennil/kapi-vim#bundle` for an opinionated Neovim configuration, including LSP runtime dependencies. - `nix profile install github:potsrevennil/kapi-vim#bundle` for installing the neovim configuration to system path - check [kapi-sysconf](https://github.com/potsrevennil/kapi-sysconf) for how to integrate with other flake modules + +## Language toolchains + +The packages ship editor-wide tooling only: nixd, lua-language-server, plus the config (prettierd, taplo, yaml-language-server), shell, typst and js (nodejs) toggles. Per-language toolchains (python, c, rust, go, haskell, lean) are off by default, because their server, formatter and linter have to match each project's compiler and CI. Provide them from the project's flake devShell and load it with direnv before starting `nvim`; the config only names the tools, so it picks up whatever is first on `PATH`, and skips any that are missing without warnings. + +On a machine without project flakes, turn languages on explicitly: + +- `KAPI_VIM_LANGS=python,go nix run --impure github:potsrevennil/kapi-vim#bundle` +- `kapi-vim.override { enable_go = true; }` when consuming the package or overlay diff --git a/flake.nix b/flake.nix index 131721f..5071109 100644 --- a/flake.nix +++ b/flake.nix @@ -146,7 +146,8 @@ }; packages = { - # nvim with built-in dependencies, but without any configuration + # nvim with editor-wide tooling (see lsp/languages.nix; per-language + # toolchains are off by default), but without any configuration default = pkgs.lib.makeOverridable (wrapKapiVim { pname = "kapi-vim"; @@ -167,9 +168,9 @@ # from lsp/languages.nix, so this list can never drift from what # lsp/default.nix actually knows how to gate) -- just the base # nixd + lua-language-server + editor tooling, fast enough for - # CI to build and smoke-test on every run. default/bundle (the - # full, every-language experience) are exercised in a separate, - # slower workflow. + # CI to build and smoke-test on every run. default (editor-wide + # tooling) and bundle (whichever languages are requested) are + # exercised in a separate, slower workflow. lite = pkgs.lib.makeOverridable (wrapKapiVim { pname = "kapi-vim-lite"; conf = bundleConf; }) allLanguagesOff; diff --git a/lsp/languages.nix b/lsp/languages.nix index c51724f..8e1f1c4 100644 --- a/lsp/languages.nix +++ b/lsp/languages.nix @@ -9,14 +9,27 @@ # for `? default` values in its own signature -- the actual package attrs # (prettierd, gopls, etc.) stay declared where they always were. { + # Editor-wide: useful on any file, independent of a project's toolchain, + # and small. On by default. config = true; # generic formatter (prettierd) + TOML/YAML LSPs -- not markdown-specific - python = true; shell = true; typst = true; - c = true; - rust = true; - go = true; - js = true; + js = true; # just nodejs; commitlint pulls it into the closure regardless + + # Project toolchains: the server, formatter and linter have to match the + # project's own compiler/runtime and its CI (HLS <-> GHC, gopls <-> go, + # black/clang-format <-> the versions CI checks with, ...), so each + # project provides them from its flake devShell and direnv puts them + # first on PATH. The Lua config only names the tools and stays quiet when + # one is missing (Neovim skips non-executable servers, conform skips + # unavailable formatters while codespell still runs, and none-ls.lua gates + # golangci-lint on PATH). Off by default; turn one on for a + # machine without project flakes with `kapi-vim.override { enable_go = + # true; }`, or `KAPI_VIM_LANGS=go nix run --impure .#bundle`. + python = false; + c = false; + rust = false; + go = false; haskell = false; lean = false; } diff --git a/lua/plugins/none-ls.lua b/lua/plugins/none-ls.lua index fd4a388..0ec6000 100644 --- a/lua/plugins/none-ls.lua +++ b/lua/plugins/none-ls.lua @@ -7,8 +7,13 @@ return { local opts = { debug = false, sources = { - -- go - diagnostics.golangci_lint, + -- go: golangci-lint comes from the project's devShell; skip + -- it (rather than erroring on spawn) where it isn't on PATH. + diagnostics.golangci_lint.with({ + runtime_condition = function() + return vim.fn.executable("golangci-lint") == 1 + end, + }), -- nix diagnostics.deadnix, code_actions.statix,