mirror of
https://github.com/nix-community/nixvim.git
synced 2025-07-15 19:54:32 +02:00
plugins/none-ls: refactor using mkSourcePlugin
Introduce `_mk-source-plugin.nix`, which returns a module handling a specific none-ls source plugin. This wasn't possible previously due to IFD conflicting with evaluating module imports. Adjusted the test to use the `options` provided via module args, and cleaned up some stuff allowing "unpackaged" sources to not be listed again in the test file.
This commit is contained in:
parent
195978e627
commit
d8f3113e90
4 changed files with 130 additions and 162 deletions
|
@ -1,4 +1,3 @@
|
|||
{ pkgs, nonels-sources-options, ... }:
|
||||
{
|
||||
# Empty configuration
|
||||
empty = {
|
||||
|
@ -100,95 +99,70 @@
|
|||
};
|
||||
|
||||
with-sources = {
|
||||
plugins.none-ls = {
|
||||
# sandbox-exec: pattern serialization length 159032 exceeds maximum (65535)
|
||||
enable = !pkgs.stdenv.isDarwin;
|
||||
module =
|
||||
{
|
||||
config,
|
||||
options,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
{
|
||||
plugins.none-ls = {
|
||||
# sandbox-exec: pattern serialization length 159032 exceeds maximum (65535)
|
||||
enable = !pkgs.stdenv.isDarwin;
|
||||
|
||||
sources =
|
||||
let
|
||||
options = nonels-sources-options.options.plugins.none-ls.sources;
|
||||
|
||||
unpackaged =
|
||||
[
|
||||
"blade_formatter"
|
||||
"bsfmt"
|
||||
"bslint"
|
||||
"cljstyle"
|
||||
"cueimports"
|
||||
# As of 2024-03-22, pkgs.d2 is broken
|
||||
# TODO: re-enable this test when fixed
|
||||
"d2_fmt"
|
||||
"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"
|
||||
"yamlfix"
|
||||
]
|
||||
++ (pkgs.lib.optionals (pkgs.stdenv.isDarwin && pkgs.stdenv.isx86_64) [
|
||||
# As of 2024-03-27, pkgs.graalvm-ce (a dependency of pkgs.clj-kondo) is broken on x86_64-darwin
|
||||
# TODO: re-enable this test when fixed
|
||||
"clj_kondo"
|
||||
])
|
||||
++ (pkgs.lib.optionals pkgs.stdenv.isDarwin [
|
||||
# As of 2024-05-22, python311Packages.k5test (one of ansible-lint's dependenvies) is broken on darwin
|
||||
# TODO: re-enable this test when fixed
|
||||
"ansible_lint"
|
||||
"clazy"
|
||||
"gdformat"
|
||||
"gdlint"
|
||||
"haml_lint"
|
||||
# As of 2024-06-29, pkgs.rubyfmt is broken on darwin
|
||||
# TODO: re-enable this test when fixed
|
||||
"rubyfmt"
|
||||
"verilator"
|
||||
"verible_verilog_format"
|
||||
])
|
||||
++ (pkgs.lib.optionals pkgs.stdenv.isAarch64 [
|
||||
"semgrep"
|
||||
"smlfmt"
|
||||
# As of 2024-03-11, swift-format is broken on aarch64
|
||||
# TODO: re-enable this test when fixed
|
||||
"swift_format"
|
||||
]);
|
||||
|
||||
sources = pkgs.lib.mapAttrs (
|
||||
_: sources:
|
||||
pkgs.lib.mapAttrs (
|
||||
source: _:
|
||||
{ enable = true; } // pkgs.lib.optionalAttrs (builtins.elem source unpackaged) { package = null; }
|
||||
) sources
|
||||
) options;
|
||||
in
|
||||
sources;
|
||||
};
|
||||
sources =
|
||||
let
|
||||
disabled =
|
||||
[
|
||||
# As of 2024-03-22, pkgs.d2 is broken
|
||||
# TODO: re-enable this test when fixed
|
||||
"d2_fmt"
|
||||
# TODO: can this be re-enabled?
|
||||
"yamlfix"
|
||||
]
|
||||
++ (lib.optionals (pkgs.stdenv.isDarwin && pkgs.stdenv.isx86_64) [
|
||||
# As of 2024-03-27, pkgs.graalvm-ce (a dependency of pkgs.clj-kondo) is broken on x86_64-darwin
|
||||
# TODO: re-enable this test when fixed
|
||||
"clj_kondo"
|
||||
])
|
||||
++ (lib.optionals pkgs.stdenv.isDarwin [
|
||||
# As of 2024-05-22, python311Packages.k5test (one of ansible-lint's dependenvies) is broken on darwin
|
||||
# TODO: re-enable this test when fixed
|
||||
"ansible_lint"
|
||||
"clazy"
|
||||
"gdformat"
|
||||
"gdlint"
|
||||
"haml_lint"
|
||||
# As of 2024-06-29, pkgs.rubyfmt is broken on darwin
|
||||
# TODO: re-enable this test when fixed
|
||||
"rubyfmt"
|
||||
"verilator"
|
||||
"verible_verilog_format"
|
||||
])
|
||||
++ (lib.optionals pkgs.stdenv.isAarch64 [
|
||||
"semgrep"
|
||||
"smlfmt"
|
||||
# As of 2024-03-11, swift-format is broken on aarch64
|
||||
# TODO: re-enable this test when fixed
|
||||
"swift_format"
|
||||
]);
|
||||
in
|
||||
# Enable every none-ls source that has an option
|
||||
lib.mapAttrs (
|
||||
_:
|
||||
lib.mapAttrs (
|
||||
sourceName: opts:
|
||||
{
|
||||
# Enable unless disabled above
|
||||
enable = !(lib.elem sourceName disabled);
|
||||
}
|
||||
# Some sources have a package option with no default
|
||||
// lib.optionalAttrs (opts ? package && !(opts.package ? default)) { package = null; }
|
||||
)
|
||||
) options.plugins.none-ls.sources;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue