1
0
Fork 0
mirror of https://github.com/nix-community/nixvim.git synced 2025-11-08 19:46:06 +01:00

lib/options (mkSettingsOption): allow more types for settingsOption when no sub-options are explicitly declared

This commit is contained in:
Gaetan Lepage 2025-10-24 11:39:35 +02:00 committed by Gaétan Lepage
parent 4439dd85cd
commit ecb75f49d1
2 changed files with 19 additions and 5 deletions

View file

@ -329,14 +329,22 @@ rec {
options ? { },
description,
example ? null,
# If no sub-options are explicitly declared, settings do not need to be a submodule.
submoduleType ? options != { },
}:
lib.mkOption {
type =
with types;
submodule {
freeformType = attrsOf lib.nixvim.lua-types.anything;
inherit options;
};
let
anyLuaType = lib.nixvim.lua-types.anything;
in
if submoduleType then
types.submodule {
freeformType = types.attrsOf anyLuaType;
inherit options;
}
else
assert options == { };
anyLuaType;
default = { };
inherit description;
example =