From 9ec2de03af7e454e0f57bd0e388a73b3cd45af11 Mon Sep 17 00:00:00 2001 From: Gaetan Lepage Date: Fri, 16 Feb 2024 18:44:10 +0100 Subject: [PATCH] colorschemes/ayu: switch to mkNeovimPlugin --- plugins/colorschemes/ayu.nix | 74 +++++++++++++++++------------------- 1 file changed, 35 insertions(+), 39 deletions(-) diff --git a/plugins/colorschemes/ayu.nix b/plugins/colorschemes/ayu.nix index 58c7c172..8dcefd5d 100644 --- a/plugins/colorschemes/ayu.nix +++ b/plugins/colorschemes/ayu.nix @@ -5,51 +5,47 @@ 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]; - mirage = helpers.defaultNullOpts.mkBool false '' - Set to `true` to use `mirage` variant instead of `dark` for dark background. + deprecateExtraConfig = true; + 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 = - 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]; - + extraConfig = cfg: { extraConfigLuaPre = '' local ayu = require("ayu") - ayu.setup(${helpers.toLuaObject setupOptions}) + ayu.setup(${helpers.toLuaObject cfg.settings}) ayu.colorscheme() ''; }; -} + }