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,51 +5,47 @@
pkgs, pkgs,
... ...
}: }:
with lib; let with lib;
cfg = config.colorschemes.ayu; helpers.neovim-plugin.mkNeovimPlugin config {
in { name = "ayu";
options = { namespace = "colorschemes";
colorschemes.ayu = originalName = "neovim-ayu";
helpers.neovim-plugin.extraOptionsOptions defaultPackage = pkgs.vimPlugins.neovim-ayu;
// { callSetup = false;
enable = mkEnableOption "ayu";
package = helpers.mkPackageOption "ayu" pkgs.vimPlugins.neovim-ayu; maintainers = [maintainers.GaetanLepage];
mirage = helpers.defaultNullOpts.mkBool false '' deprecateExtraConfig = true;
Set to `true` to use `mirage` variant instead of `dark` for dark background. optionsRenamedToSettings = [
"mirage"
"overrides"
];
settingsOptions = {
mirage = helpers.defaultNullOpts.mkBool false ''
Set to `true` to use `mirage` variant instead of `dark` for dark background.
'';
overrides =
helpers.defaultNullOpts.mkStrLuaOr
(with helpers.nixvimTypes; attrsOf highlight)
"{}"
''
A dictionary of group names, each associated with a dictionary of parameters
(`bg`, `fg`, `sp` and `style`) and colors in hex.
Alternatively, `overrides` can be a function that returns a dictionary of the same
format.
You can use the function to override based on a dynamic condition, such as the value of
`background`.
''; '';
};
overrides = extraConfig = cfg: {
helpers.defaultNullOpts.mkStrLuaOr
(with helpers.nixvimTypes; attrsOf highlight)
"{}"
''
A dictionary of group names, each associated with a dictionary of parameters
(`bg`, `fg`, `sp` and `style`) and colors in hex.
Alternatively, `overrides` can be a function that returns a dictionary of the same
format.
You can use the function to override based on a dynamic condition, such as the value of
`background`.
'';
};
};
config = let
setupOptions = with cfg;
{
inherit overrides;
}
// cfg.extraOptions;
in
mkIf cfg.enable {
extraPlugins = [cfg.package];
extraConfigLuaPre = '' extraConfigLuaPre = ''
local ayu = require("ayu") local ayu = require("ayu")
ayu.setup(${helpers.toLuaObject setupOptions}) ayu.setup(${helpers.toLuaObject cfg.settings})
ayu.colorscheme() ayu.colorscheme()
''; '';
}; };
} }