From 100876b7a3f6708a759d1c83b37f5ba7310b4c51 Mon Sep 17 00:00:00 2001 From: Gaetan Lepage Date: Mon, 12 Feb 2024 16:13:44 +0100 Subject: [PATCH] helpers/neovim-plugin: make use of helpers.mkSettingsOption --- lib/neovim-plugin.nix | 32 ++++++++++++-------------------- 1 file changed, 12 insertions(+), 20 deletions(-) diff --git a/lib/neovim-plugin.nix b/lib/neovim-plugin.nix index ee94cec6..85441ece 100644 --- a/lib/neovim-plugin.nix +++ b/lib/neovim-plugin.nix @@ -3,28 +3,20 @@ nixvimOptions, }: with lib; { - mkSettingsOption = pluginName: options: - mkOption { - type = with types; - submodule { - freeformType = with types; attrsOf anything; - inherit options; - }; - description = '' - Options provided to the `require('${pluginName}').setup` function. - ''; - default = {}; - example = { - foo_bar = 42; - hostname = "localhost:8080"; - callback.__raw = '' - function() - print('nixvim') - end - ''; - }; + mkSettingsOption = { + pluginName ? null, + options ? {}, + description ? + if pluginName != null + then "Options provided to the `require('${pluginName}').setup` function." + else throw "mkSettingsOption: Please provide either a `pluginName` or `description`.", + example ? null, + }: + nixvimOptions.mkSettingsOption { + inherit options description example; }; + # TODO: DEPRECATED: use the `settings` option instead extraOptionsOptions = { extraOptions = mkOption { default = {};