-
-
Notifications
You must be signed in to change notification settings - Fork 269
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests/lsp-servers: de-couple from grouped tests
Follow up to cab6b0c
- Loading branch information
1 parent
88302aa
commit af650ba
Showing
3 changed files
with
99 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,53 +1,83 @@ | ||
{ pkgs, ... }: | ||
{ lib, options, ... }: | ||
pkgs.lib.optionalAttrs | ||
# This fails on darwin | ||
# See https://github.com/NixOS/nix/issues/4119 | ||
(!pkgs.stdenv.isDarwin) | ||
{ | ||
{ | ||
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; | ||
|
||
plugins.lsp = { | ||
enable = true; | ||
|
||
servers = | ||
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" | ||
]); | ||
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; | ||
|
||
renamed = lib.attrNames (import ../plugins/lsp/language-servers/_renamed.nix); | ||
in | ||
lib.mkMerge [ | ||
(lib.pipe options.plugins.lsp.servers [ | ||
(lib.mapAttrs ( | ||
server: opts: | ||
{ | ||
enable = !(lib.elem server disabled); | ||
} | ||
// lib.optionalAttrs (opts ? package && !(opts.package ? default)) { package = null; } | ||
)) | ||
(lib.filterAttrs (server: _: !(lib.elem server renamed))) | ||
]) | ||
plugins.lsp.servers = lib.pipe options.plugins.lsp.servers [ | ||
(lib.mapAttrs ( | ||
server: opts: | ||
{ | ||
rust_analyzer = { | ||
installCargo = true; | ||
installRustc = true; | ||
}; | ||
enable = !(lib.elem server disabled); | ||
} | ||
]; | ||
// lib.optionalAttrs (opts ? package && !(opts.package ? default)) { package = null; } | ||
)) | ||
(lib.filterAttrs (server: _: !(lib.elem server renamed))) | ||
]; | ||
}; | ||
} | ||
|
||
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 |