From 254b15d066bfb997a321e44b8880eca2aad2068b Mon Sep 17 00:00:00 2001 From: Austin Horstman Date: Fri, 20 Sep 2024 13:30:20 -0500 Subject: [PATCH] plugins/nvim-tree: iconsPackage -> icons provider options --- plugins/by-name/nvim-tree/default.nix | 26 ++++++++++++------- .../plugins/by-name/fidget/default.nix | 1 + .../plugins/by-name/nvim-tree/default.nix | 4 ++- 3 files changed, 21 insertions(+), 10 deletions(-) diff --git a/plugins/by-name/nvim-tree/default.nix b/plugins/by-name/nvim-tree/default.nix index 1db9b6e2..3d17aee0 100644 --- a/plugins/by-name/nvim-tree/default.nix +++ b/plugins/by-name/nvim-tree/default.nix @@ -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 ]; diff --git a/tests/test-sources/plugins/by-name/fidget/default.nix b/tests/test-sources/plugins/by-name/fidget/default.nix index bd51d005..96e3027d 100644 --- a/tests/test-sources/plugins/by-name/fidget/default.nix +++ b/tests/test-sources/plugins/by-name/fidget/default.nix @@ -104,6 +104,7 @@ nvim-tree.enable = true; }; }; + web-devicons.enable = true; }; }; } diff --git a/tests/test-sources/plugins/by-name/nvim-tree/default.nix b/tests/test-sources/plugins/by-name/nvim-tree/default.nix index 4947f5f2..07bf19e1 100644 --- a/tests/test-sources/plugins/by-name/nvim-tree/default.nix +++ b/tests/test-sources/plugins/by-name/nvim-tree/default.nix @@ -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; }; };