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;
|
with nixvimUtils;
|
||||||
rec {
|
rec {
|
||||||
# Creates an option with a nullable type that defaults to null.
|
# Creates an option with a nullable type that defaults to null.
|
||||||
mkNullOrOption =
|
mkNullOrOption' =
|
||||||
type: desc:
|
{
|
||||||
lib.mkOption {
|
type,
|
||||||
|
default ? null,
|
||||||
|
...
|
||||||
|
}@args:
|
||||||
|
lib.mkOption (
|
||||||
|
args
|
||||||
|
// {
|
||||||
type = lib.types.nullOr type;
|
type = lib.types.nullOr type;
|
||||||
default = null;
|
inherit default;
|
||||||
description = desc;
|
}
|
||||||
};
|
);
|
||||||
|
mkNullOrOption = type: description: mkNullOrOption' { inherit type description; };
|
||||||
|
|
||||||
mkCompositeOption = desc: options: mkNullOrOption (types.submodule { inherit options; }) desc;
|
mkCompositeOption = desc: options: mkNullOrOption (types.submodule { inherit options; }) desc;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue