From 707054bf239d9d705bfcdf877f970dd27a5f84bc Mon Sep 17 00:00:00 2001 From: Gaetan Lepage Date: Mon, 6 Nov 2023 10:49:38 +0100 Subject: [PATCH] helpers: factor out borderType --- lib/helpers.nix | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/helpers.nix b/lib/helpers.nix index 5c30f4c6..b4fec303 100644 --- a/lib/helpers.nix +++ b/lib/helpers.nix @@ -91,6 +91,13 @@ with lib; rec { }; }; + borderType = with lib.types; + oneOf [ + str + (listOf str) + (listOf (listOf str)) + ]; + # Creates an option with a nullable type that defaults to null. mkNullOrOption = type: desc: lib.mkOption { @@ -146,14 +153,7 @@ with lib; rec { mkEnumFirstDefault = enum: mkEnum enum (head enum); mkBorder = default: name: desc: mkNullable - ( - with lib.types; - oneOf [ - str - (listOf str) - (listOf (listOf str)) - ] - ) + borderType default (let defaultDesc = ''