plugins/chadtree: iconsPackage -> icons provider options

This commit is contained in:
Austin Horstman 2024-09-20 09:47:05 -05:00
parent 81ae3febd2
commit 23a903f13c
No known key found for this signature in database
2 changed files with 168 additions and 133 deletions

View file

@ -3,6 +3,7 @@
helpers, helpers,
config, config,
pkgs, pkgs,
options,
... ...
}: }:
with lib; with lib;
@ -11,6 +12,20 @@ let
mkListStr = helpers.defaultNullOpts.mkNullable (types.listOf types.str); mkListStr = helpers.defaultNullOpts.mkNullable (types.listOf types.str);
in in
{ {
# TODO: added 2024-09-20 remove after 24.11
imports = [
(lib.mkRemovedOptionModule
[
"plugins"
"chadtree"
"iconsPackage"
]
''
Please use `plugins.web-devicons` or `plugins.mini.modules.icons` with `plugins.mini.mockDevIcons` instead.
''
)
];
options.plugins.chadtree = helpers.neovim-plugin.extraOptionsOptions // { options.plugins.chadtree = helpers.neovim-plugin.extraOptionsOptions // {
enable = mkEnableOption "chadtree"; enable = mkEnableOption "chadtree";
@ -21,11 +36,6 @@ in
]; ];
}; };
iconsPackage = lib.mkPackageOption pkgs [
"vimPlugins"
"nvim-web-devicons"
] { nullable = true; };
options = { options = {
follow = helpers.defaultNullOpts.mkBool true '' follow = helpers.defaultNullOpts.mkBool true ''
CHADTree will highlight currently open file, and open all its parents. CHADTree will highlight currently open file, and open all its parents.
@ -415,7 +425,7 @@ in
let let
setupOptions = with cfg; { setupOptions = with cfg; {
xdg = true; xdg = true;
options = with options; { options = with cfg.options; {
inherit follow; inherit follow;
inherit lang; inherit lang;
mimetypes = with mimetypes; { mimetypes = with mimetypes; {
@ -502,11 +512,33 @@ in
}; };
in in
mkIf cfg.enable { mkIf cfg.enable {
extraPlugins = # TODO: added 2024-09-20 remove after 24.11
[ cfg.package ] plugins.web-devicons =
++ (optional ( lib.mkIf
cfg.iconsPackage != null && (cfg.theme == null || cfg.theme.iconGlyphSet == "devicons") (
) cfg.iconsPackage); (cfg.theme == null || cfg.theme.iconGlyphSet == "devicons")
&& !(
config.plugins.mini.enable
&& config.plugins.mini.modules ? icons
&& config.plugins.mini.mockDevIcons
)
)
{
enable = lib.mkOverride 1490 false;
};
warnings =
optional
(
(cfg.theme == null || cfg.theme.iconGlyphSet == "devicons")
&& options.plugins.web-devicons.enable.highestPrio == 1490
)
''
Nixvim (plugins.chadtree) `web-devicons` automatic installation is deprecated.
Please use `plugins.web-devicons` or `plugins.mini.modules.icons` with `plugins.mini.mockDevIcons` instead.
'';
extraPlugins = [ cfg.package ];
extraConfigLua = '' extraConfigLua = ''
vim.api.nvim_set_var("chadtree_settings", ${helpers.toLuaObject setupOptions}) vim.api.nvim_set_var("chadtree_settings", ${helpers.toLuaObject setupOptions})

View file

@ -4,7 +4,9 @@
}; };
example = { example = {
plugins.chadtree = { plugins = {
web-devicons.enable = true;
chadtree = {
enable = true; enable = true;
options = { options = {
@ -132,11 +134,12 @@
}; };
}; };
}; };
};
no-packages = { no-icons = {
plugins.web-devicons.enable = false;
plugins.chadtree = { plugins.chadtree = {
enable = true; enable = true;
iconsPackage = null;
}; };
}; };
} }