colorschemes/ayu: switch to mkNeovimPlugin

This commit is contained in:
Gaetan Lepage 2024-02-16 18:44:10 +01:00 committed by Gaétan Lepage
parent efdd9f2688
commit 9ec2de03af

View file

@ -5,17 +5,23 @@
pkgs,
...
}:
with lib; let
cfg = config.colorschemes.ayu;
in {
options = {
colorschemes.ayu =
helpers.neovim-plugin.extraOptionsOptions
// {
enable = mkEnableOption "ayu";
with lib;
helpers.neovim-plugin.mkNeovimPlugin config {
name = "ayu";
namespace = "colorschemes";
originalName = "neovim-ayu";
defaultPackage = pkgs.vimPlugins.neovim-ayu;
callSetup = false;
package = helpers.mkPackageOption "ayu" pkgs.vimPlugins.neovim-ayu;
maintainers = [maintainers.GaetanLepage];
deprecateExtraConfig = true;
optionsRenamedToSettings = [
"mirage"
"overrides"
];
settingsOptions = {
mirage = helpers.defaultNullOpts.mkBool false ''
Set to `true` to use `mirage` variant instead of `dark` for dark background.
'';
@ -34,22 +40,12 @@ in {
`background`.
'';
};
};
config = let
setupOptions = with cfg;
{
inherit overrides;
}
// cfg.extraOptions;
in
mkIf cfg.enable {
extraPlugins = [cfg.package];
extraConfig = cfg: {
extraConfigLuaPre = ''
local ayu = require("ayu")
ayu.setup(${helpers.toLuaObject setupOptions})
ayu.setup(${helpers.toLuaObject cfg.settings})
ayu.colorscheme()
'';
};
}
}