From 23230295a49983c1560d131c62a0d33ceff831fd Mon Sep 17 00:00:00 2001 From: Gabriel Arazas Date: Thu, 15 Aug 2024 12:49:44 +0800 Subject: [PATCH] nixvim/plugins/nvim-config-local: update to RFC-45-style settings --- modules/nixvim/plugins/nvim-config-local.nix | 42 +++++++++----------- 1 file changed, 18 insertions(+), 24 deletions(-) diff --git a/modules/nixvim/plugins/nvim-config-local.nix b/modules/nixvim/plugins/nvim-config-local.nix index df1d61e9..9c5403b8 100644 --- a/modules/nixvim/plugins/nvim-config-local.nix +++ b/modules/nixvim/plugins/nvim-config-local.nix @@ -4,40 +4,34 @@ let cfg = config.plugins.nvim-config-local; in { - options.plugins.nvim-config-local = - helpers.neovim-plugin.extraOptionsOptions // { - enable = lib.mkEnableOption "nvim-config-local"; + options.plugins.nvim-config-local = { + enable = lib.mkEnableOption "nvim-config-local"; - package = helpers.mkPluginPackageOption "nvim-config-local" pkgs.vimPlugins.nvim-config-local; + package = helpers.mkPluginPackageOption "nvim-config-local" pkgs.vimPlugins.nvim-config-local; - configFiles = lib.mkOption { - type = with lib.types; listOf str; - default = [ ".nvim.lua" ".nvimrc" ".exrc" ]; - example = [ "config/nvim.lua" ]; - description = '' - A list of patterns to load (includes Lua configurations). - ''; + settings = lib.mkOption { + type = lib.types.submodule { + freeformType = with lib.types; attrsOf anything; + options = { + config_files = lib.mkOption { + type = with lib.types; listOf str; + default = [ ".nvim.lua" ".nvimrc" ".exrc" ]; + example = [ "config/nvim.lua" ]; + description = '' + A list of patterns to load (includes Lua configurations). + ''; + }; + }; }; - - autocommandsCreate = helpers.defaultNullOpts.mkBool true "Create autocommands for sourcing local files."; - commandsCreate = helpers.defaultNullOpts.mkBool true "Create user commands for nvim-config-local."; - lookupParents = helpers.defaultNullOpts.mkBool false "Enable lookup in parent directories when sourcing local configs."; }; + }; config = - let - setupOptions = { - config_files = cfg.configFiles; - autocommands_create = cfg.autocommandsCreate; - commands_create = cfg.commandsCreate; - lookup_parents = cfg.lookupParents; - } // cfg.extraOptions; - in lib.mkIf cfg.enable { extraPlugins = [ cfg.package ]; extraConfigLua = '' - require("config-local").setup(${helpers.toLuaConfig setupOptions}) + require("config-local").setup(${helpers.toLuaConfig cfg.settings}) ''; }; }