mirror of
https://github.com/nix-community/nixvim.git
synced 2025-11-08 19:46:06 +01:00
plugins/efmls-configs: migrate to mkNeovimPlugin
This commit is contained in:
parent
4a274251bf
commit
fa8240195a
1 changed files with 115 additions and 118 deletions
|
|
@ -1,25 +1,39 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
tools = lib.importJSON ../../../generated/efmls-configs-sources.json;
|
||||
inherit (import ./packages.nix lib) packaged;
|
||||
in
|
||||
{
|
||||
options.plugins.efmls-configs = {
|
||||
enable = lib.mkEnableOption "efmls-configs, premade configurations for efm-langserver";
|
||||
lib.nixvim.plugins.mkNeovimPlugin {
|
||||
name = "efmls-configs";
|
||||
package = "efmls-configs-nvim";
|
||||
description = "Premade configurations for efm-langserver.";
|
||||
maintainers = [ ];
|
||||
|
||||
package = lib.mkPackageOption pkgs "efmls-configs-nvim" {
|
||||
default = [
|
||||
"vimPlugins"
|
||||
"efmls-configs-nvim"
|
||||
dependencies = [
|
||||
"efm-langserver"
|
||||
];
|
||||
};
|
||||
imports = [
|
||||
# TODO: added 2025-10-23, remove after 26.05
|
||||
(lib.nixvim.mkRemovedPackageOptionModule {
|
||||
plugin = "efmls-configs";
|
||||
oldPackageName = "efmLangServer";
|
||||
packageName = "efm-langserver";
|
||||
})
|
||||
|
||||
# Propagate setup warnings
|
||||
{ inherit (config.plugins.efmls-configs.setup) warnings; }
|
||||
];
|
||||
|
||||
hasSettings = false;
|
||||
callSetup = false;
|
||||
|
||||
extraOptions =
|
||||
let
|
||||
inherit (import ./packages.nix lib) packaged;
|
||||
tools = lib.importJSON ../../../generated/efmls-configs-sources.json;
|
||||
in
|
||||
{
|
||||
externallyManagedPackages = lib.mkOption {
|
||||
type = with lib.types; either (enum [ "all" ]) (listOf str);
|
||||
description = ''
|
||||
|
|
@ -105,10 +119,10 @@ in
|
|||
default = { };
|
||||
};
|
||||
};
|
||||
config =
|
||||
let
|
||||
cfg = config.plugins.efmls-configs;
|
||||
|
||||
extraConfig =
|
||||
cfg:
|
||||
let
|
||||
# Tools that have been selected by the user
|
||||
tools = lib.lists.unique (
|
||||
lib.filter lib.isString (
|
||||
|
|
@ -152,7 +166,7 @@ in
|
|||
mkToolValue =
|
||||
kind: opt:
|
||||
map (
|
||||
tool: if lib.isString tool then helpers.mkRaw "require 'efmls-configs.${kind}.${tool}'" else tool
|
||||
tool: if lib.isString tool then lib.nixvim.mkRaw "require 'efmls-configs.${kind}.${tool}'" else tool
|
||||
) (lib.toList opt);
|
||||
|
||||
setupOptions =
|
||||
|
|
@ -177,9 +191,7 @@ in
|
|||
(mkToolValue "linters" cfg.setup.all.linter) ++ (mkToolValue "formatters" cfg.setup.all.formatter);
|
||||
};
|
||||
in
|
||||
lib.mkIf cfg.enable {
|
||||
extraPlugins = [ cfg.package ];
|
||||
|
||||
{
|
||||
# TODO: print the location of the offending options
|
||||
warnings = lib.nixvim.mkWarnings "plugins.efmls-configs" {
|
||||
when = nixvimPkgs.wrong != [ ];
|
||||
|
|
@ -196,20 +208,5 @@ in
|
|||
};
|
||||
|
||||
extraPackages = map (name: cfg.toolPackages.${name}) nixvimPkgs.right;
|
||||
dependencies.efm-langserver.enable = lib.mkDefault true;
|
||||
};
|
||||
|
||||
imports = [
|
||||
{
|
||||
# Propagate setup warnings
|
||||
inherit (config.plugins.efmls-configs.setup) warnings;
|
||||
}
|
||||
|
||||
# TODO: added 2025-10-23, remove after 26.05
|
||||
(lib.nixvim.mkRemovedPackageOptionModule {
|
||||
plugin = "efmls-configs";
|
||||
oldPackageName = "efmLangServer";
|
||||
packageName = "efm-langserver";
|
||||
})
|
||||
];
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue