plugins/tagbar: switch to using mkPlugin

This commit is contained in:
Gaetan Lepage 2024-01-07 11:40:13 +01:00 committed by Gaétan Lepage
parent bc0886c6bb
commit c498d0b9c9

View file

@ -1,32 +1,13 @@
{
lib,
helpers,
config,
pkgs,
...
}: let
cfg = config.plugins.tagbar;
in
with lib; {
options.plugins.tagbar = {
enable = mkEnableOption "tagbar";
package = helpers.mkPackageOption "tagbar" pkgs.vimPlugins.tagbar;
extraConfig = helpers.mkNullOrOption types.attrs ''
The configuration options for tagbar without the 'tagbar_' prefix.
Example: To set 'tagbar_show_tag_count' to 1, write
extraConfig = {
show_tag_count = true;
};
'';
};
config = mkIf cfg.enable {
extraPlugins = [cfg.package];
} @ args:
with lib;
with import ../helpers.nix {inherit lib;};
mkPlugin args {
name = "tagbar";
package = pkgs.vimPlugins.tagbar;
globalPrefix = "tagbar_";
extraPackages = [pkgs.ctags];
globals = mapAttrs' (name: nameValuePair ("tagbar_" + name)) cfg.extraConfig;
};
}