helpers/options: add mkSettingsOption

This commit is contained in:
Gaetan Lepage 2024-02-12 16:11:34 +01:00 committed by Gaétan Lepage
parent 3871b56b15
commit e3e14dbe1d

View file

@ -237,4 +237,31 @@ with nixvimUtils; rec {
inherit default;
description = "Plugin to use for ${name}";
};
mkSettingsOption = {
options ? {},
description,
example ? null,
}:
mkOption {
type = with types;
submodule {
freeformType = with types; attrsOf anything;
inherit options;
};
default = {};
inherit description;
example =
if example == null
then {
foo_bar = 42;
hostname = "localhost:8080";
callback.__raw = ''
function()
print('nixvim')
end
'';
}
else example;
};
}