plugins/alpha: use iconsPackage

This commit is contained in:
Austin Horstman 2024-08-29 09:54:31 -05:00
parent f2ef2929ad
commit 0db6e86e8d
No known key found for this signature in database
2 changed files with 32 additions and 3 deletions

View file

@ -2,6 +2,7 @@
lib, lib,
helpers, helpers,
config, config,
options,
pkgs, pkgs,
... ...
}: }:
@ -55,10 +56,16 @@ in
package = helpers.mkPluginPackageOption "alpha-nvim" pkgs.vimPlugins.alpha-nvim; package = helpers.mkPluginPackageOption "alpha-nvim" pkgs.vimPlugins.alpha-nvim;
# TODO: deprecated 2024-08-29 remove after 24.11
iconsEnabled = mkOption { iconsEnabled = mkOption {
type = types.bool; type = types.bool;
description = "Toggle icon support. Installs nvim-web-devicons."; 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 { theme = mkOption {
@ -139,9 +146,24 @@ in
let let
layoutDefined = cfg.layout != [ ]; layoutDefined = cfg.layout != [ ];
themeDefined = cfg.theme != null; themeDefined = cfg.theme != null;
opt = options.plugins.alpha;
in in
mkIf cfg.enable { 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 = [ assertions = [
{ {

View file

@ -34,7 +34,6 @@
plugins.alpha = { plugins.alpha = {
enable = true; enable = true;
iconsEnabled = true;
layout = [ layout = [
{ {
type = "padding"; type = "padding";
@ -100,4 +99,12 @@
}; };
}; };
}; };
no-packages = {
plugins.alpha = {
enable = true;
theme = "dashboard";
iconsPackage = null;
};
};
} }