From 52350c178687a216774d74183e8c1077507324be Mon Sep 17 00:00:00 2001 From: traxys Date: Tue, 24 Jan 2023 22:46:25 +0100 Subject: [PATCH] helpers: Add helpers to make nullable enums with default values --- lib/helpers.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/helpers.nix b/lib/helpers.nix index 393ba2ab..a71a3acf 100644 --- a/lib/helpers.nix +++ b/lib/helpers.nix @@ -88,6 +88,8 @@ rec { mkInt = default: mkNullable lib.types.int (toString default); mkBool = default: mkNullable lib.types.bool (if default then "true" else "false"); 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