From 40c57ce052cc8ef1bf0c836b87263a43b69e1fb6 Mon Sep 17 00:00:00 2001 From: 7FM <41307817+7FM@users.noreply.github.com> Date: Wed, 6 Mar 2024 14:09:53 +0100 Subject: [PATCH] programs.khal: Simplify calendar setup (#5073) * programs.khal: fix build failure due to null value * calendar: allow null value for primaryCollection * calendar / programs.khal: set default values to avoid common errors --- modules/accounts/calendar.nix | 11 +++++++---- modules/programs/khal-calendar-accounts.nix | 4 ++-- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/modules/accounts/calendar.nix b/modules/accounts/calendar.nix index e96f2f2d..961cd0b3 100644 --- a/modules/accounts/calendar.nix +++ b/modules/accounts/calendar.nix @@ -18,12 +18,13 @@ let type = mkOption { type = types.enum [ "filesystem" "singlefile" ]; + default = "filesystem"; description = "The type of the storage."; }; fileExt = mkOption { type = types.nullOr types.str; - default = null; + default = ".ics"; description = "The file extension to use."; }; @@ -98,7 +99,8 @@ let }; primaryCollection = mkOption { - type = types.str; + type = types.nullOr types.str; + default = null; description = '' The primary collection of the account. Required when an account has multiple collections. @@ -106,8 +108,8 @@ let }; local = mkOption { - type = types.nullOr (localModule name); - default = null; + type = localModule name; + default = { }; description = '' Local configuration for the calendar. ''; @@ -129,6 +131,7 @@ in { options.accounts.calendar = { basePath = mkOption { type = types.str; + example = ".calendar"; apply = p: if hasPrefix "/" p then p else "${config.home.homeDirectory}/${p}"; description = '' diff --git a/modules/programs/khal-calendar-accounts.nix b/modules/programs/khal-calendar-accounts.nix index 0a56ba81..3aa2494e 100644 --- a/modules/programs/khal-calendar-accounts.nix +++ b/modules/programs/khal-calendar-accounts.nix @@ -5,8 +5,8 @@ with lib; { options.khal = { type = mkOption { - type = types.nullOr (types.enum [ "calendar" "discover" ]); - default = null; + type = types.enum [ "calendar" "discover" ]; + default = "calendar"; description = '' Either a single calendar (calendar which is the default) or a directory with multiple calendars (discover). '';