mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-21 08:35:43 +02:00
dev: Add a script to generate efmls-configs tools
This commit is contained in:
parent
87c7757a5b
commit
c1231826b9
3 changed files with 214 additions and 0 deletions
|
@ -13,12 +13,17 @@
|
|||
nix build .#rust-analyzer-options
|
||||
cat ./result >"$generated_dir"/rust-analyzer.nix
|
||||
|
||||
# efmls-configs
|
||||
nix build .#efmls-configs-sources
|
||||
cat ./result >"$generated_dir"/efmls-configs.nix
|
||||
|
||||
nix fmt
|
||||
'';
|
||||
};
|
||||
|
||||
packages = {
|
||||
rust-analyzer-options = pkgs.callPackage ./rust-analyzer.nix { };
|
||||
efmls-configs-sources = pkgs.callPackage ./efmls-configs.nix { };
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
69
flake-modules/updates/efmls-configs.nix
Normal file
69
flake-modules/updates/efmls-configs.nix
Normal file
|
@ -0,0 +1,69 @@
|
|||
{
|
||||
lib,
|
||||
vimPlugins,
|
||||
writeText,
|
||||
pkgs,
|
||||
}:
|
||||
let
|
||||
tools = lib.trivial.importJSON "${vimPlugins.efmls-configs-nvim.src}/doc/supported-list.json";
|
||||
languages = lib.attrNames tools;
|
||||
|
||||
toLangTools' = lang: kind: lib.map (lib.getAttr "name") (tools.${lang}.${kind} or [ ]);
|
||||
|
||||
miscLinters = toLangTools' "misc" "linters";
|
||||
miscFormatters = toLangTools' "misc" "formatters";
|
||||
|
||||
sources =
|
||||
(lib.listToAttrs (
|
||||
lib.map (
|
||||
lang:
|
||||
let
|
||||
toLangTools = toLangTools' lang;
|
||||
in
|
||||
{
|
||||
name = lang;
|
||||
value = {
|
||||
linter = {
|
||||
inherit lang;
|
||||
possible = (toLangTools "linters") ++ miscLinters;
|
||||
};
|
||||
formatter = {
|
||||
inherit lang;
|
||||
possible = (toLangTools "formatters") ++ miscFormatters;
|
||||
};
|
||||
};
|
||||
}
|
||||
) languages
|
||||
))
|
||||
// {
|
||||
all = {
|
||||
linter = {
|
||||
lang = "all languages";
|
||||
possible = miscLinters;
|
||||
};
|
||||
formatter = {
|
||||
lang = "all languages";
|
||||
possible = miscFormatters;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
inherit (import ../../plugins/lsp/language-servers/efmls-configs-pkgs.nix pkgs) packaged unpackaged;
|
||||
|
||||
toolList = lib.lists.unique (
|
||||
lib.concatLists (
|
||||
lib.map ({ linter, formatter }: linter.possible ++ formatter.possible) (lib.attrValues sources)
|
||||
)
|
||||
);
|
||||
|
||||
unknownTools = lib.filter (tool: !(lib.hasAttr tool packaged || lib.elem tool unpackaged)) toolList;
|
||||
in
|
||||
assert lib.assertMsg (lib.length unknownTools == 0)
|
||||
"The following tools are neither marked as unpackaged nor as packaged: ${
|
||||
lib.generators.toPretty { } unknownTools
|
||||
}";
|
||||
writeText "efmls-configs-sources.nix" (
|
||||
"# WARNING: DO NOT EDIT\n"
|
||||
+ "# This file is generated with packages.<system>.efmls-configs-sources, which is run automatically by CI\n"
|
||||
+ (lib.generators.toPretty { } sources)
|
||||
)
|
140
plugins/lsp/language-servers/efmls-configs-pkgs.nix
Normal file
140
plugins/lsp/language-servers/efmls-configs-pkgs.nix
Normal file
|
@ -0,0 +1,140 @@
|
|||
pkgs: {
|
||||
# efmls-configs tools that have no corresponding nixpkgs package
|
||||
unpackaged = [
|
||||
"blade_formatter"
|
||||
"cspell"
|
||||
"cljstyle"
|
||||
"dartanalyzer"
|
||||
"debride"
|
||||
"deno_fmt"
|
||||
"fecs"
|
||||
"fixjson"
|
||||
"forge_fmt"
|
||||
"gersemi"
|
||||
"js_standard"
|
||||
"pint"
|
||||
"prettier_eslint"
|
||||
"prettier_standard"
|
||||
"redpen"
|
||||
"reek"
|
||||
"rome"
|
||||
"slim_lint"
|
||||
"solhint"
|
||||
"sorbet"
|
||||
"swiftformat"
|
||||
"swiftlint"
|
||||
"xo"
|
||||
];
|
||||
|
||||
# Mapping from a efmls-configs tool name to the corresponding nixpkgs package
|
||||
packaged = with pkgs; {
|
||||
inherit
|
||||
actionlint
|
||||
alejandra
|
||||
ameba
|
||||
astyle
|
||||
bashate
|
||||
beautysh
|
||||
biome
|
||||
black
|
||||
buf
|
||||
cbfmt
|
||||
checkmake
|
||||
clazy
|
||||
codespell
|
||||
cppcheck
|
||||
cpplint
|
||||
dfmt
|
||||
djlint
|
||||
dmd
|
||||
dprint
|
||||
fish
|
||||
flawfinder
|
||||
fnlfmt
|
||||
gcc
|
||||
gitlint
|
||||
gofumpt
|
||||
golines
|
||||
golint
|
||||
hadolint
|
||||
isort
|
||||
joker
|
||||
jq
|
||||
languagetool
|
||||
mypy
|
||||
php
|
||||
prettierd
|
||||
prettypst
|
||||
proselint
|
||||
protolint
|
||||
pylint
|
||||
rubocop
|
||||
ruff
|
||||
rustfmt
|
||||
scalafmt
|
||||
selene
|
||||
shellcheck
|
||||
shellharden
|
||||
shfmt
|
||||
smlfmt
|
||||
sqlfluff
|
||||
statix
|
||||
stylua
|
||||
taplo
|
||||
typstfmt
|
||||
typstyle
|
||||
uncrustify
|
||||
vale
|
||||
yamllint
|
||||
yapf
|
||||
;
|
||||
inherit (python3.pkgs)
|
||||
autopep8
|
||||
flake8
|
||||
mdformat
|
||||
vulture
|
||||
;
|
||||
inherit (nodePackages)
|
||||
eslint
|
||||
eslint_d
|
||||
prettier
|
||||
alex
|
||||
sql-formatter
|
||||
stylelint
|
||||
textlint
|
||||
write-good
|
||||
;
|
||||
inherit (phpPackages) phan phpstan psalm;
|
||||
inherit (luaPackages) luacheck;
|
||||
inherit (haskellPackages) fourmolu;
|
||||
ansible_lint = ansible-lint;
|
||||
chktex = texliveMedium;
|
||||
clang_format = clang-tools;
|
||||
clang_tidy = clang-tools;
|
||||
clj_kondo = clj-kondo;
|
||||
cmake_lint = cmake-format;
|
||||
dartfmt = dart;
|
||||
dotnet_format = dotnet-runtime;
|
||||
fish_indent = fish;
|
||||
gofmt = go;
|
||||
goimports = go-tools;
|
||||
golangci_lint = golangci-lint;
|
||||
google_java_format = google-java-format;
|
||||
go_revive = revive;
|
||||
latexindent = texliveMedium;
|
||||
lua_format = luaformatter;
|
||||
markdownlint = markdownlint-cli;
|
||||
mcs = mono;
|
||||
nixfmt = nixfmt-classic;
|
||||
phpcbf = phpPackages.php-codesniffer;
|
||||
php_cs_fixer = phpPackages.php-cs-fixer;
|
||||
phpcs = phpPackages.php-codesniffer;
|
||||
prettier_d = prettierd;
|
||||
slither = slither-analyzer;
|
||||
staticcheck = go-tools;
|
||||
terraform_fmt = terraform;
|
||||
vint = vim-vint;
|
||||
write_good = write-good;
|
||||
yq = yq-go;
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue