2024-10-10 18:47:28 +01:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
nixvimConfiguration,
|
|
|
|
stdenv,
|
|
|
|
runCommandNoCCLocal,
|
|
|
|
name ? "lsp-all-servers",
|
|
|
|
}:
|
|
|
|
let
|
|
|
|
_file = ./lsp-servers.nix;
|
|
|
|
|
|
|
|
renamed = builtins.attrNames (import ../plugins/lsp/language-servers/_renamed.nix);
|
|
|
|
|
|
|
|
enable-lsp-module = {
|
|
|
|
inherit _file;
|
|
|
|
|
2024-10-05 14:23:31 +02:00
|
|
|
plugins.lsp = {
|
|
|
|
enable = true;
|
|
|
|
|
2024-10-10 18:47:28 +01:00
|
|
|
servers.rust_analyzer = {
|
|
|
|
installCargo = true;
|
|
|
|
installRustc = true;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
enable-servers-module =
|
|
|
|
{
|
|
|
|
lib,
|
|
|
|
options,
|
|
|
|
pkgs,
|
|
|
|
...
|
|
|
|
}:
|
|
|
|
let
|
|
|
|
disabled =
|
|
|
|
lib.optionals pkgs.stdenv.isDarwin [
|
|
|
|
"fsautocomplete"
|
|
|
|
]
|
|
|
|
++ lib.optionals pkgs.stdenv.isAarch64 [
|
|
|
|
# Broken
|
|
|
|
"scheme_langserver"
|
|
|
|
]
|
|
|
|
++ lib.optionals (pkgs.stdenv.hostPlatform.system == "aarch64-linux") [
|
|
|
|
# Binary package not available for this architecture
|
|
|
|
"starpls"
|
|
|
|
# TODO: 2024-10-05 build failure
|
|
|
|
"fstar"
|
|
|
|
]
|
|
|
|
++ lib.optionals (pkgs.stdenv.hostPlatform.system == "x86_64-darwin") [
|
|
|
|
# Binary package not available for this architecture
|
|
|
|
"starpls"
|
|
|
|
];
|
|
|
|
in
|
|
|
|
{
|
|
|
|
inherit _file;
|
2024-10-05 16:11:12 +02:00
|
|
|
|
2024-10-10 18:47:28 +01:00
|
|
|
plugins.lsp.servers = lib.pipe options.plugins.lsp.servers [
|
|
|
|
(lib.mapAttrs (
|
|
|
|
server: opts:
|
2024-10-05 16:11:12 +02:00
|
|
|
{
|
2024-10-10 18:47:28 +01:00
|
|
|
enable = !(lib.elem server disabled);
|
2024-10-05 16:11:12 +02:00
|
|
|
}
|
2024-10-10 18:47:28 +01:00
|
|
|
// lib.optionalAttrs (opts ? package && !(opts.package ? default)) { package = null; }
|
|
|
|
))
|
|
|
|
(lib.filterAttrs (server: _: !(lib.elem server renamed)))
|
|
|
|
];
|
2024-10-05 14:23:31 +02:00
|
|
|
};
|
2024-10-10 18:47:28 +01:00
|
|
|
|
|
|
|
result = nixvimConfiguration.extendModules {
|
|
|
|
modules = [
|
|
|
|
enable-lsp-module
|
|
|
|
enable-servers-module
|
|
|
|
{ test.name = name; }
|
|
|
|
];
|
|
|
|
};
|
|
|
|
in
|
|
|
|
# This fails on darwin
|
|
|
|
# See https://github.com/NixOS/nix/issues/4119
|
|
|
|
if stdenv.isDarwin then
|
|
|
|
runCommandNoCCLocal name { } ''
|
|
|
|
touch $out
|
|
|
|
''
|
|
|
|
else
|
|
|
|
result.config.build.test
|