plugins/alpha: iconsPackage -> icons provider options

This commit is contained in:
Austin Horstman 2024-09-20 13:06:57 -05:00
parent 7a3423ae18
commit b2929765ab
No known key found for this signature in database
2 changed files with 50 additions and 20 deletions

View file

@ -51,6 +51,20 @@ let
}; };
in in
{ {
# TODO: added 2024-09-20 remove after 24.11
imports = [
(lib.mkRemovedOptionModule
[
"plugins"
"alpha"
"iconsPackage"
]
''
Please use `plugins.web-devicons` or `plugins.mini.modules.icons` with `plugins.mini.mockDevIcons` instead.
''
)
];
options = { options = {
plugins.alpha = { plugins.alpha = {
enable = lib.mkEnableOption "alpha-nvim"; enable = lib.mkEnableOption "alpha-nvim";
@ -69,11 +83,6 @@ in
visible = false; visible = false;
}; };
iconsPackage = lib.mkPackageOption pkgs [
"vimPlugins"
"nvim-web-devicons"
] { nullable = true; };
theme = mkOption { theme = mkOption {
type = with types; nullOr (maybeRaw str); type = with types; nullOr (maybeRaw str);
apply = v: if lib.isString v then lib.nixvim.mkRaw "require'alpha.themes.${v}'.config" else v; apply = v: if lib.isString v then lib.nixvim.mkRaw "require'alpha.themes.${v}'.config" else v;
@ -156,20 +165,41 @@ in
opt = options.plugins.alpha; opt = options.plugins.alpha;
in in
lib.mkIf cfg.enable { lib.mkIf cfg.enable {
# 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 ${lib.showFiles opt.iconsEnabled.files} has been deprecated; please remove it.
You should use `plugins.alpha.iconsPackage' instead.
''
];
extraPlugins = # TODO: added 2024-09-20 remove after 24.11
[ cfg.package ] warnings = lib.optionals opt.iconsEnabled.isDefined (
++ lib.optional ( [
cfg.iconsPackage != null && (opt.iconsEnabled.isDefined -> cfg.iconsEnabled) ''
) cfg.iconsPackage; The option definition `plugins.alpha.iconsEnabled' in ${lib.showFiles opt.iconsEnabled.files} has been deprecated; please remove it.
''
]
++
lib.optional
(
(opt.iconsEnabled.isDefined -> cfg.iconsEnabled)
&& options.plugins.web-devicons.enable.highestPrio == 1490
)
''
Nixvim (plugins.alpha) `web-devicons` automatic installation is deprecated.
Please use `plugins.web-devicons` or `plugins.mini.modules.icons` with `plugins.mini.mockDevIcons` instead.
''
);
plugins.web-devicons =
lib.mkIf
(
opt.iconsEnabled.isDefined
&& cfg.iconsEnabled
&& !(
config.plugins.mini.enable
&& config.plugins.mini.modules ? icons
&& config.plugins.mini.mockDevIcons
)
)
{
enable = lib.mkOverride 1490 true;
};
extraPlugins = [ cfg.package ];
assertions = [ assertions = [
{ {

View file

@ -100,11 +100,11 @@
}; };
}; };
no-packages = { no-icons = {
plugins.web-devicons.enable = false;
plugins.alpha = { plugins.alpha = {
enable = true; enable = true;
theme = "dashboard"; theme = "dashboard";
iconsPackage = null;
}; };
}; };
} }