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, helpers,
pkgs, pkgs,
config, config,
options,
... ...
}: }:
with lib; with lib;
let let
cfg = config.plugins.nvim-tree; cfg = config.plugins.nvim-tree;
inherit (helpers) ifNonNull';
openWinConfigOption = openWinConfigOption =
helpers.defaultNullOpts.mkAttributeSet helpers.defaultNullOpts.mkAttributeSet
@ -46,11 +46,6 @@ in
]; ];
}; };
iconsPackage = lib.mkPackageOption pkgs [
"vimPlugins"
"nvim-web-devicons"
] { nullable = true; };
gitPackage = lib.mkPackageOption pkgs "git" { gitPackage = lib.mkPackageOption pkgs "git" {
nullable = true; nullable = true;
}; };
@ -929,7 +924,7 @@ in
config = config =
let let
options = setupOptions =
with cfg; with cfg;
{ {
disable_netrw = disableNetrw; disable_netrw = disableNetrw;
@ -1168,9 +1163,22 @@ in
''; '';
in in
mkIf cfg.enable { 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 = [ extraPlugins = [
cfg.package cfg.package
] ++ lib.optional (cfg.iconsPackage != null) cfg.iconsPackage; ];
autoCmd = autoCmd =
(optional autoOpenEnabled { (optional autoOpenEnabled {
@ -1187,7 +1195,7 @@ in
(optionalString autoOpenEnabled openNvimTreeFunction) (optionalString autoOpenEnabled openNvimTreeFunction)
+ '' + ''
require('nvim-tree').setup(${helpers.toLuaObject options}) require('nvim-tree').setup(${helpers.toLuaObject setupOptions})
''; '';
extraPackages = [ cfg.gitPackage ]; extraPackages = [ cfg.gitPackage ];

View file

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

View file

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