helpers: Add helpers to make nullable enums with default values

This commit is contained in:
traxys 2023-01-24 22:46:25 +01:00
parent eada2a76db
commit 52350c1786

View file

@ -88,6 +88,8 @@ rec {
mkInt = default: mkNullable lib.types.int (toString default); mkInt = default: mkNullable lib.types.int (toString default);
mkBool = default: mkNullable lib.types.bool (if default then "true" else "false"); mkBool = default: mkNullable lib.types.bool (if default then "true" else "false");
mkStr = default: mkNullable lib.types.str ''"${default}"''; mkStr = default: mkNullable lib.types.str ''"${default}"'';
mkEnum = enum: default: mkNullable (lib.types.enum enum) ''"${default}"'';
mkEnumFirstDefault = enum: mkEnum enum (head enum);
}; };
mkPlugin = { config, lib, ... }: { name mkPlugin = { config, lib, ... }: { name