plugins/nvim-tree: iconsPackage -> icons provider options

This commit is contained in:
Austin Horstman 2024-09-20 13:30:20 -05:00
parent e23bd5475c
commit 254b15d066
No known key found for this signature in database
3 changed files with 21 additions and 10 deletions

View file

@ -3,12 +3,12 @@
helpers,
pkgs,
config,
options,
...
}:
with lib;
let
cfg = config.plugins.nvim-tree;
inherit (helpers) ifNonNull';
openWinConfigOption =
helpers.defaultNullOpts.mkAttributeSet
@ -46,11 +46,6 @@ in
];
};
iconsPackage = lib.mkPackageOption pkgs [
"vimPlugins"
"nvim-web-devicons"
] { nullable = true; };
gitPackage = lib.mkPackageOption pkgs "git" {
nullable = true;
};
@ -929,7 +924,7 @@ in
config =
let
options =
setupOptions =
with cfg;
{
disable_netrw = disableNetrw;
@ -1168,9 +1163,22 @@ in
'';
in
mkIf cfg.enable {
# TODO: added 2024-09-20 remove after 24.11
plugins.web-devicons = mkIf (
!(
config.plugins.mini.enable
&& config.plugins.mini.modules ? icons
&& config.plugins.mini.mockDevIcons
)
) { enable = mkOverride 1490 true; };
warnings = optional (options.plugins.web-devicons.enable.highestPrio == 1490) ''
Nixvim (plugins.nvim-tree) `web-devicons` automatic installation is deprecated.
Please use `plugins.web-devicons` or `plugins.mini.modules.icons` with `plugins.mini.mockDevIcons` instead.
'';
extraPlugins = [
cfg.package
] ++ lib.optional (cfg.iconsPackage != null) cfg.iconsPackage;
];
autoCmd =
(optional autoOpenEnabled {
@ -1187,7 +1195,7 @@ in
(optionalString autoOpenEnabled openNvimTreeFunction)
+ ''
require('nvim-tree').setup(${helpers.toLuaObject options})
require('nvim-tree').setup(${helpers.toLuaObject setupOptions})
'';
extraPackages = [ cfg.gitPackage ];

View file

@ -104,6 +104,7 @@
nvim-tree.enable = true;
};
};
web-devicons.enable = true;
};
};
}

View file

@ -1,9 +1,11 @@
{
empty = {
plugins.web-devicons.enable = true;
plugins.nvim-tree.enable = true;
};
defaults = {
plugins.web-devicons.enable = true;
plugins.nvim-tree = {
enable = true;
@ -258,9 +260,9 @@
};
no-packages = {
plugins.web-devicons.enable = true;
plugins.nvim-tree = {
enable = true;
iconsPackage = null;
gitPackage = null;
};
};