From 9feb535acecac26338f481812eebb5368071ac34 Mon Sep 17 00:00:00 2001 From: Arpit Chakladar Date: Sat, 10 Oct 2026 05:35:42 +0530 Subject: feat(office/khal): support multiple calendars --- modules/office/khal/assertions.nix | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 modules/office/khal/assertions.nix (limited to 'modules/office/khal/assertions.nix') diff --git a/modules/office/khal/assertions.nix b/modules/office/khal/assertions.nix new file mode 100644 index 0000000..bda7797 --- /dev/null +++ b/modules/office/khal/assertions.nix @@ -0,0 +1,20 @@ +# Validates the configured khal calendars. +{ config, lib, ... }: +let + cfg = config.office.khal; + primaryCalendars = builtins.filter (calendar: calendar.primary) (builtins.attrValues cfg.calendars); +in +{ + config = lib.mkIf cfg.enable { + assertions = [ + { + assertion = cfg.calendars != { }; + message = "office.khal.enable requires at least one office.khal.calendars entry."; + } + { + assertion = builtins.length primaryCalendars == 1; + message = "Exactly one office.khal.calendars entry must set primary = true."; + } + ]; + }; +} -- cgit v1.2.3