Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
9 changes: 5 additions & 4 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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;
Expand Down
23 changes: 18 additions & 5 deletions lsp/languages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
9 changes: 7 additions & 2 deletions lua/plugins/none-ls.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Loading