diff --git a/plugins/utils/alpha.nix b/plugins/utils/alpha.nix index 2febc2848..dbb5fb912 100644 --- a/plugins/utils/alpha.nix +++ b/plugins/utils/alpha.nix @@ -2,6 +2,7 @@ lib, helpers, config, + options, pkgs, ... }: @@ -55,10 +56,16 @@ in package = helpers.mkPluginPackageOption "alpha-nvim" pkgs.vimPlugins.alpha-nvim; + # TODO: deprecated 2024-08-29 remove after 24.11 iconsEnabled = mkOption { type = types.bool; description = "Toggle icon support. Installs nvim-web-devicons."; - default = true; + visible = false; + }; + + iconsPackage = helpers.mkPackageOption { + name = "nvim-web-devicons"; + default = pkgs.vimPlugins.nvim-web-devicons; }; theme = mkOption { @@ -139,9 +146,24 @@ in let layoutDefined = cfg.layout != [ ]; themeDefined = cfg.theme != null; + + opt = options.plugins.alpha; in mkIf cfg.enable { - extraPlugins = [ cfg.package ] ++ (optional cfg.iconsEnabled pkgs.vimPlugins.nvim-web-devicons); + # TODO: deprecated 2024-08-29 remove after 24.11 + warnings = lib.mkIf opt.iconsEnabled.isDefined [ + '' + nixvim (plugins.alpha): + The option definition `plugins.alpha.iconsEnabled' in ${showFiles opt.iconsEnabled.files} has been deprecated; please remove it. + You should use `plugins.alpha.iconsPackage' instead. + '' + ]; + + extraPlugins = + [ cfg.package ] + ++ lib.optional ( + cfg.iconsPackage != null && (opt.iconsEnabled.isDefined && cfg.iconsEnabled) + ) cfg.iconsPackage; assertions = [ { diff --git a/tests/test-sources/plugins/utils/alpha.nix b/tests/test-sources/plugins/utils/alpha.nix index 77534a43f..9eedf9c4c 100644 --- a/tests/test-sources/plugins/utils/alpha.nix +++ b/tests/test-sources/plugins/utils/alpha.nix @@ -34,7 +34,6 @@ plugins.alpha = { enable = true; - iconsEnabled = true; layout = [ { type = "padding"; @@ -100,4 +99,12 @@ }; }; }; + + no-packages = { + plugins.alpha = { + enable = true; + theme = "dashboard"; + iconsPackage = null; + }; + }; }