plugins/lsp/efmls-configs: respect tool packages availability

This commit is contained in:
Gaetan Lepage 2023-11-19 14:27:43 +01:00 committed by Gaétan Lepage
parent a05b2a9cbf
commit 3cb12cd964
2 changed files with 60 additions and 24 deletions

View file

@ -11,7 +11,7 @@ with lib; let
languages = builtins.attrNames tools; languages = builtins.attrNames tools;
# Mapping of tool name to the nixpkgs package (if any) # Mapping of tool name to the nixpkgs package (if any)
toolPkgs = with pkgs; { allToolPkgs = with pkgs; {
inherit inherit
actionlint actionlint
alejandra alejandra
@ -99,6 +99,16 @@ with lib; let
write_good = write-good; write_good = write-good;
yq = yq-go; yq = yq-go;
}; };
# Filter packages that are not compatible with the current platform
toolPkgs =
filterAttrs
(
a: pkg:
meta.availableOn
pkgs.stdenv.hostPlatform
pkg
)
allToolPkgs;
in { in {
options.plugins.efmls-configs = { options.plugins.efmls-configs = {
enable = mkEnableOption "efmls-configs, premade configurations for efm-langserver"; enable = mkEnableOption "efmls-configs, premade configurations for efm-langserver";
@ -249,6 +259,14 @@ in {
extraOptions.settings.languages = setupOptions; extraOptions.settings.languages = setupOptions;
}; };
extraPackages = [pkgs.efm-langserver] ++ (builtins.map (v: toolPkgs.${v}) nixvimPkgs.right); extraPackages =
[
pkgs.efm-langserver
]
++ (
builtins.map
(v: toolPkgs.${v})
nixvimPkgs.right
);
}; };
} }

View file

@ -1,4 +1,8 @@
{efmls-options, ...}: { {
efmls-options,
pkgs,
...
}: {
empty = { empty = {
plugins.efmls-configs.enable = true; plugins.efmls-configs.enable = true;
}; };
@ -16,27 +20,41 @@
"phpstan" "phpstan"
]; ];
unpackaged = [ unpackaged =
"blade_formatter" [
"cspell" "blade_formatter"
"dartanalyzer" "cspell"
"debride" "dartanalyzer"
"fecs" "debride"
"fixjson" "fecs"
"forge_fmt" "fixjson"
"gersemi" "forge_fmt"
"js_standard" "gersemi"
"pint" "js_standard"
"prettier_eslint" "pint"
"prettier_standard" "prettier_eslint"
"redpen" "prettier_standard"
"reek" "redpen"
"rome" "reek"
"slim_lint" "rome"
"solhint" "slim_lint"
"sorbet" "solhint"
"xo" "sorbet"
]; "xo"
]
++ (
pkgs.lib.optionals
pkgs.stdenv.isDarwin
["clazy"]
)
++ (
pkgs.lib.optionals
pkgs.stdenv.isAarch64
[
"dmd"
"smlfmt"
]
);
# Fetch the valid enum members from the tool options # Fetch the valid enum members from the tool options
toolsFromOptions = opt: let toolsFromOptions = opt: let