{
  config,
  pkgs,
  lib,
  ...
}: let
  cfg = config.programs.neovim.rose-pine;
  enable = cfg.enable && config.programs.neovim.enable;
in {
  options.programs.neovim.rose-pine = lib.rp.mkRosePineOpt {name = "neovim";};

  config.programs.neovim = lib.mkIf enable {
    plugins = with pkgs.vimPlugins; [
      {
        plugin = rose-pine;
        config = ''
          lua << EOF
            require("rose-pine").setup({
            	variant = "${cfg.flavor}",
            })

            vim.api.nvim_command("colorscheme rose-pine")
          EOF
        '';
      }
    ];
  };
}
