mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-21 08:35:43 +02:00
lib/options: add mkNullOrOption'
variant
This commit is contained in:
parent
57003fea4e
commit
fc542329cd
1 changed files with 14 additions and 7 deletions
|
@ -7,13 +7,20 @@ with lib;
|
|||
with nixvimUtils;
|
||||
rec {
|
||||
# Creates an option with a nullable type that defaults to null.
|
||||
mkNullOrOption =
|
||||
type: desc:
|
||||
lib.mkOption {
|
||||
mkNullOrOption' =
|
||||
{
|
||||
type,
|
||||
default ? null,
|
||||
...
|
||||
}@args:
|
||||
lib.mkOption (
|
||||
args
|
||||
// {
|
||||
type = lib.types.nullOr type;
|
||||
default = null;
|
||||
description = desc;
|
||||
};
|
||||
inherit default;
|
||||
}
|
||||
);
|
||||
mkNullOrOption = type: description: mkNullOrOption' { inherit type description; };
|
||||
|
||||
mkCompositeOption = desc: options: mkNullOrOption (types.submodule { inherit options; }) desc;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue