mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-21 00:25:42 +02:00
plugins/efmls: use mkPackageOption
This commit is contained in:
parent
2ef974182e
commit
a8a7e405f4
3 changed files with 153 additions and 119 deletions
|
@ -1,4 +1,4 @@
|
|||
pkgs: {
|
||||
lib: {
|
||||
# efmls-configs tools that have no corresponding nixpkgs package
|
||||
unpackaged = [
|
||||
"blade_formatter"
|
||||
|
@ -27,115 +27,149 @@ pkgs: {
|
|||
];
|
||||
|
||||
# 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
|
||||
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_d
|
||||
prettier
|
||||
alex
|
||||
sql-formatter
|
||||
stylelint
|
||||
textlint
|
||||
;
|
||||
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;
|
||||
# TODO: Added 2024-08-31; remove 2024-11-31
|
||||
# eslint was moved out of nodePackages set without alias
|
||||
# Using fallback as a transition period
|
||||
eslint = pkgs.eslint or pkgs.nodePackages.eslint;
|
||||
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;
|
||||
};
|
||||
packaged =
|
||||
let
|
||||
# TODO: move these helpers to a shared location so that none-ls can also use them
|
||||
topLevel = names: lib.genAttrs names lib.id;
|
||||
scoped = lib.concatMapAttrs (
|
||||
scope: v:
|
||||
if builtins.isAttrs v then
|
||||
lib.mapAttrs (_: loc: [ scope ] ++ loc) (scoped v)
|
||||
else
|
||||
lib.genAttrs (lib.toList v) (name: [
|
||||
scope
|
||||
name
|
||||
])
|
||||
);
|
||||
in
|
||||
# Top-level packages
|
||||
topLevel [
|
||||
"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"
|
||||
"prettypst"
|
||||
"proselint"
|
||||
"protolint"
|
||||
"pylint"
|
||||
"rubocop"
|
||||
"ruff"
|
||||
"rustfmt"
|
||||
"scalafmt"
|
||||
"selene"
|
||||
"shellcheck"
|
||||
"shellharden"
|
||||
"shfmt"
|
||||
"smlfmt"
|
||||
"sqlfluff"
|
||||
"statix"
|
||||
"stylua"
|
||||
"taplo"
|
||||
"typstfmt"
|
||||
"typstyle"
|
||||
"uncrustify"
|
||||
"vale"
|
||||
"yamllint"
|
||||
"yapf"
|
||||
]
|
||||
# Scoped packages
|
||||
// scoped {
|
||||
python3.pkgs = [
|
||||
"autopep8"
|
||||
"flake8"
|
||||
"mdformat"
|
||||
"vulture"
|
||||
];
|
||||
nodePackages = [
|
||||
"eslint" # FIXME: No way to have a transition fallback...
|
||||
"eslint_d"
|
||||
"prettier"
|
||||
"alex"
|
||||
"sql-formatter"
|
||||
"stylelint"
|
||||
"textlint"
|
||||
];
|
||||
phpPackages = [
|
||||
"phan"
|
||||
"phpstan"
|
||||
"psalm"
|
||||
];
|
||||
luaPackages = [
|
||||
"luacheck"
|
||||
];
|
||||
haskellPackages = [
|
||||
"fourmolu"
|
||||
];
|
||||
}
|
||||
# Packages where the name is different
|
||||
// {
|
||||
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";
|
||||
};
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
}:
|
||||
let
|
||||
tools = import ../../../generated/efmls-configs.nix;
|
||||
inherit (import ./efmls-configs-pkgs.nix pkgs) packaged;
|
||||
inherit (import ./efmls-configs-pkgs.nix lib) packaged;
|
||||
in
|
||||
{
|
||||
options.plugins.efmls-configs = {
|
||||
|
@ -26,10 +26,10 @@ in
|
|||
toolPackages = lib.pipe packaged [
|
||||
# Produce package a option for each tool
|
||||
(lib.attrsets.mapAttrs (
|
||||
tool: pkg:
|
||||
helpers.mkPackageOption {
|
||||
name = tool;
|
||||
default = pkg;
|
||||
name: loc:
|
||||
lib.mkPackageOption pkgs name {
|
||||
nullable = true;
|
||||
default = loc;
|
||||
}
|
||||
))
|
||||
# Filter package defaults that are not compatible with the current platform
|
||||
|
@ -38,7 +38,7 @@ in
|
|||
if lib.meta.availableOn pkgs.stdenv.hostPlatform opt.default then
|
||||
opt
|
||||
else
|
||||
opt // { default = null; }
|
||||
builtins.removeAttrs opt [ "defaultText" ] // { default = null; }
|
||||
))
|
||||
];
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ let
|
|||
|
||||
declared =
|
||||
let
|
||||
inherit (import ../plugins/lsp/language-servers/efmls-configs-pkgs.nix pkgs) packaged unpackaged;
|
||||
inherit (import ../plugins/lsp/language-servers/efmls-configs-pkgs.nix lib) packaged unpackaged;
|
||||
in
|
||||
unpackaged ++ lib.attrsets.attrNames packaged;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue