plugins/none-ls: combine packaged+unpackaged lists

We can just make `packaged` nullable again.
This commit is contained in:
Matt Sturgeon 2024-07-11 22:52:53 +01:00
parent d8f3113e90
commit 4f3cd9f368
No known key found for this signature in database
GPG key ID: 4F91844CED1A8299
3 changed files with 223 additions and 226 deletions

View file

@ -5,7 +5,7 @@
pkgs,
}:
let
inherit (import ../../plugins/none-ls/packages.nix pkgs) packaged noPackage unpackaged;
inherit (import ../../plugins/none-ls/packages.nix pkgs) packaged noPackage;
builtinSources = lib.trivial.importJSON "${vimPlugins.none-ls-nvim.src}/doc/builtins.json";
@ -14,11 +14,11 @@ let
toolNames = lib.unique (lib.flatten (lib.attrValues builtinSourceNames));
undeclaredTool = lib.filter (
name: !(lib.hasAttr name packaged || lib.elem name noPackage || lib.elem name unpackaged)
name: !(lib.hasAttr name packaged || lib.elem name noPackage)
) toolNames;
uselesslyDeclaredTool = lib.filter (name: !(lib.elem name toolNames)) (
unpackaged ++ noPackage ++ (lib.attrNames packaged)
noPackage ++ (lib.attrNames packaged)
);
in
writeText "efmls-configs-sources.nix" (

View file

@ -8,7 +8,8 @@ sourceType: sourceName:
...
}:
let
inherit (import ./packages.nix pkgs) packaged unpackaged;
inherit (import ./packages.nix pkgs) packaged;
pkg = packaged.${sourceName};
cfg = config.plugins.none-ls;
cfg' = config.plugins.none-ls.sources.${sourceType}.${sourceName};
@ -22,27 +23,23 @@ in
'';
}
# Only declare a package option if a package is required
// lib.optionalAttrs (packaged ? ${sourceName} || lib.elem sourceName unpackaged) {
package =
let
pkg = packaged.${sourceName} or null;
in
lib.mkOption (
{
type = lib.types.nullOr lib.types.package;
description =
"Package to use for ${sourceName}."
+ (lib.optionalString (pkg == null) (
"\n\n"
+ ''
Currently not packaged in nixpkgs.
Either set this to `null` and install ${sourceName} outside of nix,
or set this to a custom nix package.
''
));
}
// lib.optionalAttrs (pkg != null) { default = pkg; }
);
// lib.optionalAttrs (packaged ? ${sourceName}) {
package = lib.mkOption (
{
type = lib.types.nullOr lib.types.package;
description =
"Package to use for ${sourceName}."
+ (lib.optionalString (pkg == null) (
"\n\n"
+ ''
Currently not packaged in nixpkgs.
Either set this to `null` and install ${sourceName} outside of nix,
or set this to a custom nix package.
''
));
}
// lib.optionalAttrs (pkg != null) { default = pkg; }
);
};
config = lib.mkIf (cfg.enable && cfg'.enable) {

View file

@ -1,46 +1,4 @@
pkgs: {
# builtin sources that are not packaged in nixpkgs
unpackaged = [
"blade_formatter"
"bsfmt"
"bslint"
"cljstyle"
"cueimports"
"erb_lint"
"findent"
"forge_fmt"
"gccdiag"
"gersemi"
"markuplint"
"mlint"
"nginx_beautifier"
"npm_groovy_lint"
"ocdc"
"packer"
"perlimports"
"pint"
"pretty_php"
"purs_tidy"
"pyink"
"reek"
"regal"
"remark"
"rescript"
"saltlint"
"solhint"
"spectral"
"sqlfmt"
"sql_formatter"
"styler"
"stylint"
"swiftformat"
"swiftlint"
"textidote"
"textlint"
"twigcs"
"vacuum"
];
# builtin sources that don't require a package
noPackage = [
"gitrebase"
@ -60,163 +18,205 @@ pkgs: {
];
# nixpkgs packages for a given source
packaged = {
inherit (pkgs)
actionlint
alejandra
asmfmt
astyle
bibclean
biome
buf
cbfmt
checkmake
checkstyle
clazy
codespell
commitlint
cppcheck
csharpier
deadnix
dfmt
djhtml
djlint
erlfmt
fantomas
fish
fnlfmt
fprettify
gitlint
gofumpt
golines
hadolint
hclfmt
isort
joker
just
ktlint
leptosfmt
mdformat
mdl
mypy
pmd
prettierd
proselint
protolint
pylint
revive
rstcheck
rubocop
rubyfmt
rufo
rustywind
scalafmt
selene
semgrep
shellharden
shfmt
smlfmt
sqlfluff
statix
stylelint
stylua
tfsec
topiary
treefmt
trivy
typstfmt
typstyle
uncrustify
usort
vale
verilator
yamlfix
yamlfmt
yamllint
yapf
zprint
zsh
;
inherit (pkgs.nodePackages) alex prettier;
inherit (pkgs.python3.pkgs) black;
inherit (pkgs.phpPackages) phpmd phpstan;
inherit (pkgs.rubyPackages) htmlbeautifier;
inherit (pkgs.ocamlPackages) ocamlformat;
ansiblelint = pkgs.ansible-lint;
bean_check = pkgs.beancount;
bean_format = pkgs.beancount;
blackd = pkgs.black;
buildifier = pkgs.bazel-buildtools;
cfn_lint = pkgs.python3.pkgs.cfn-lint;
clang_format = pkgs.clang-tools;
clj_kondo = pkgs.clj-kondo;
cmake_format = pkgs.cmake-format;
cmake_lint = pkgs.cmake-format;
credo = pkgs.elixir;
crystal_format = pkgs.crystal;
cue_fmt = pkgs.cue;
d2_fmt = pkgs.d2;
dart_format = pkgs.dart;
dictionary = pkgs.curl;
dotenv_linter = pkgs.dotenv-linter;
dxfmt = pkgs.dioxus-cli;
editorconfig_checker = pkgs.editorconfig-checker;
elm_format = pkgs.elmPackages.elm-format;
emacs_scheme_mode = pkgs.emacs;
emacs_vhdl_mode = pkgs.emacs;
erb_format = pkgs.rubyPackages.erb-formatter;
fish_indent = pkgs.fish;
format_r = pkgs.R;
# TODO: Added 2024-06-13; remove 2024-09-13
# Nixpkgs renamed to _3 & _4 without maintaining an alias
# Out of sync lock files could be using either attr name...
gdformat = pkgs.gdtoolkit_4 or pkgs.gdtoolkit;
gdlint = pkgs.gdtoolkit_4 or pkgs.gdtoolkit;
gitsigns = pkgs.git;
gleam_format = pkgs.gleam;
glslc = pkgs.shaderc;
gn_format = pkgs.gn;
gofmt = pkgs.go;
goimports = pkgs.gotools;
goimports_reviser = pkgs.goimports-reviser;
golangci_lint = pkgs.golangci-lint;
google_java_format = pkgs.google-java-format;
haml_lint = pkgs.mastodon;
haxe_formatter = pkgs.haxe;
isortd = pkgs.isort;
ltrs = pkgs.languagetool-rust;
markdownlint_cli2 = pkgs.markdownlint-cli2;
markdownlint = pkgs.nodePackages.markdownlint-cli;
mix = pkgs.elixir;
nimpretty = pkgs.nim;
nixfmt = pkgs.nixfmt-classic;
nixpkgs_fmt = pkgs.nixpkgs-fmt;
opacheck = pkgs.open-policy-agent;
opentofu_fmt = pkgs.opentofu;
pg_format = pkgs.pgformatter;
phpcbf = pkgs.phpPackages.php-codesniffer;
phpcsfixer = pkgs.phpPackages.php-cs-fixer;
phpcs = pkgs.phpPackages.php-codesniffer;
prisma_format = pkgs.nodePackages.prisma;
ptop = pkgs.fpc;
puppet_lint = pkgs.puppet-lint;
qmlformat = pkgs.qt6.qtdeclarative;
qmllint = pkgs.qt6.qtdeclarative;
racket_fixw = pkgs.racket;
raco_fmt = pkgs.racket;
rego = pkgs.open-policy-agent;
rpmspec = pkgs.rpm;
sqlformat = pkgs.python3.pkgs.sqlparse;
staticcheck = pkgs.go-tools;
surface = pkgs.elixir;
swift_format = pkgs.swift-format;
teal = pkgs.luaPackages.tl;
terraform_fmt = pkgs.terraform;
terraform_validate = pkgs.terraform;
tidy = pkgs.html-tidy;
verible_verilog_format = pkgs.verible;
vint = pkgs.vim-vint;
write_good = pkgs.write-good;
xmllint = pkgs.libxml2;
};
packaged =
{
inherit (pkgs)
actionlint
alejandra
asmfmt
astyle
bibclean
biome
buf
cbfmt
checkmake
checkstyle
clazy
codespell
commitlint
cppcheck
csharpier
deadnix
dfmt
djhtml
djlint
erlfmt
fantomas
fish
fnlfmt
fprettify
gitlint
gofumpt
golines
hadolint
hclfmt
isort
joker
just
ktlint
leptosfmt
mdformat
mdl
mypy
pmd
prettierd
proselint
protolint
pylint
revive
rstcheck
rubocop
rubyfmt
rufo
rustywind
scalafmt
selene
semgrep
shellharden
shfmt
smlfmt
sqlfluff
statix
stylelint
stylua
tfsec
topiary
treefmt
trivy
typstfmt
typstyle
uncrustify
usort
vale
verilator
yamlfix
yamlfmt
yamllint
yapf
zprint
zsh
;
inherit (pkgs.nodePackages) alex prettier;
inherit (pkgs.python3.pkgs) black;
inherit (pkgs.phpPackages) phpmd phpstan;
inherit (pkgs.rubyPackages) htmlbeautifier;
inherit (pkgs.ocamlPackages) ocamlformat;
ansiblelint = pkgs.ansible-lint;
bean_check = pkgs.beancount;
bean_format = pkgs.beancount;
blackd = pkgs.black;
buildifier = pkgs.bazel-buildtools;
cfn_lint = pkgs.python3.pkgs.cfn-lint;
clang_format = pkgs.clang-tools;
clj_kondo = pkgs.clj-kondo;
cmake_format = pkgs.cmake-format;
cmake_lint = pkgs.cmake-format;
credo = pkgs.elixir;
crystal_format = pkgs.crystal;
cue_fmt = pkgs.cue;
d2_fmt = pkgs.d2;
dart_format = pkgs.dart;
dictionary = pkgs.curl;
dotenv_linter = pkgs.dotenv-linter;
dxfmt = pkgs.dioxus-cli;
editorconfig_checker = pkgs.editorconfig-checker;
elm_format = pkgs.elmPackages.elm-format;
emacs_scheme_mode = pkgs.emacs;
emacs_vhdl_mode = pkgs.emacs;
erb_format = pkgs.rubyPackages.erb-formatter;
fish_indent = pkgs.fish;
format_r = pkgs.R;
# TODO: Added 2024-06-13; remove 2024-09-13
# Nixpkgs renamed to _3 & _4 without maintaining an alias
# Out of sync lock files could be using either attr name...
gdformat = pkgs.gdtoolkit_4 or pkgs.gdtoolkit;
gdlint = pkgs.gdtoolkit_4 or pkgs.gdtoolkit;
gitsigns = pkgs.git;
gleam_format = pkgs.gleam;
glslc = pkgs.shaderc;
gn_format = pkgs.gn;
gofmt = pkgs.go;
goimports = pkgs.gotools;
goimports_reviser = pkgs.goimports-reviser;
golangci_lint = pkgs.golangci-lint;
google_java_format = pkgs.google-java-format;
haml_lint = pkgs.mastodon;
haxe_formatter = pkgs.haxe;
isortd = pkgs.isort;
ltrs = pkgs.languagetool-rust;
markdownlint_cli2 = pkgs.markdownlint-cli2;
markdownlint = pkgs.nodePackages.markdownlint-cli;
mix = pkgs.elixir;
nimpretty = pkgs.nim;
nixfmt = pkgs.nixfmt-classic;
nixpkgs_fmt = pkgs.nixpkgs-fmt;
opacheck = pkgs.open-policy-agent;
opentofu_fmt = pkgs.opentofu;
pg_format = pkgs.pgformatter;
phpcbf = pkgs.phpPackages.php-codesniffer;
phpcsfixer = pkgs.phpPackages.php-cs-fixer;
phpcs = pkgs.phpPackages.php-codesniffer;
prisma_format = pkgs.nodePackages.prisma;
ptop = pkgs.fpc;
puppet_lint = pkgs.puppet-lint;
qmlformat = pkgs.qt6.qtdeclarative;
qmllint = pkgs.qt6.qtdeclarative;
racket_fixw = pkgs.racket;
raco_fmt = pkgs.racket;
rego = pkgs.open-policy-agent;
rpmspec = pkgs.rpm;
sqlformat = pkgs.python3.pkgs.sqlparse;
staticcheck = pkgs.go-tools;
surface = pkgs.elixir;
swift_format = pkgs.swift-format;
teal = pkgs.luaPackages.tl;
terraform_fmt = pkgs.terraform;
terraform_validate = pkgs.terraform;
tidy = pkgs.html-tidy;
verible_verilog_format = pkgs.verible;
vint = pkgs.vim-vint;
write_good = pkgs.write-good;
xmllint = pkgs.libxml2;
}
# builtin sources that are not packaged in nixpkgs
// pkgs.lib.genAttrs [
"blade_formatter"
"bsfmt"
"bslint"
"cljstyle"
"cueimports"
"erb_lint"
"findent"
"forge_fmt"
"gccdiag"
"gersemi"
"markuplint"
"mlint"
"nginx_beautifier"
"npm_groovy_lint"
"ocdc"
"packer"
"perlimports"
"pint"
"pretty_php"
"purs_tidy"
"pyink"
"reek"
"regal"
"remark"
"rescript"
"saltlint"
"solhint"
"spectral"
"sqlfmt"
"sql_formatter"
"styler"
"stylint"
"swiftformat"
"swiftlint"
"textidote"
"textlint"
"twigcs"
"vacuum"
] (_: null);
}