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,12 +23,8 @@ 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 (
// lib.optionalAttrs (packaged ? ${sourceName}) {
package = lib.mkOption (
{
type = lib.types.nullOr lib.types.package;
description =

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,7 +18,8 @@ pkgs: {
];
# nixpkgs packages for a given source
packaged = {
packaged =
{
inherit (pkgs)
actionlint
alejandra
@ -218,5 +177,46 @@ pkgs: {
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);
}