plugins/lsp: add packageFallback option
Some checks are pending
Publish every Git push to main to FlakeHub / flakehub-publish (push) Waiting to run
Publish every git push to Flakestry / publish-flake (push) Waiting to run
Documentation / Build unstable (push) Waiting to run
Documentation / Build 24.11 (push) Waiting to run
Documentation / Build 25.05 (push) Waiting to run
Documentation / Combine builds (push) Blocked by required conditions
Documentation / Deploy (push) Blocked by required conditions

https://github.com/nix-community/nixvim/pull/3445#pullrequestreview-2908615597
This commit is contained in:
sportshead 2025-06-08 23:30:08 +01:00 committed by Matt Sturgeon
parent ee715541ab
commit 6a054de04d
4 changed files with 77 additions and 6 deletions

View file

@ -265,4 +265,58 @@
}
];
};
package-fallback =
{ config, ... }:
{
test.buildNixvim = false;
plugins.lsp = {
enable = true;
servers = {
nil_ls = {
enable = true;
packageFallback = true;
};
rust_analyzer = {
enable = true;
installCargo = true;
installRustc = true;
packageFallback = true;
};
hls = {
enable = true;
installGhc = true;
packageFallback = true;
};
};
};
assertions =
let
assertAfter = name: pkg: [
{
assertion = lib.all (x: x != pkg) config.extraPackages;
message = "Expected `${name}` not to be in extraPackages";
}
{
assertion = lib.any (x: x == pkg) config.extraPackagesAfter;
message = "Expected `${name}` to be in extraPackagesAfter";
}
];
in
with config.plugins.lsp.servers;
(
assertAfter "nil" nil_ls.package
++ assertAfter "rust-analyzer" rust_analyzer.package
++ assertAfter "cargo" rust_analyzer.cargoPackage
++ assertAfter "rustc" rust_analyzer.rustcPackage
++ assertAfter "haskell-language-server" hls.package
++ assertAfter "ghc" hls.ghcPackage
);
};
}