remove backwards compatibility
M flake.nix → flake.nix
@@ -123,34 +123,6 @@ cfg = config.services.mycal; settingsFormat = pkgs.formats.toml { }; inherit (lib) mkEnableOption mkOption mkIf types; - - calendarOptionType = types.submodule { - options = { - file = mkOption { - type = with types; nullOr str; - default = ""; - example = "/path/to/calendar/file"; - description = '' - Path to the calendar file. Preferred over URL. - ''; - }; - url = mkOption { - type = with types; nullOr str; - default = ""; - example = "https://example.com/calendar.ics"; - description = '' - URL to the calendar file. - ''; - }; - all_tentative = mkOption { - type = types.bool; - default = false; - description = '' - Whether all events from this calendar should be marked as tentative. - ''; - }; - }; - }; in { options.services.mycal = {@@ -204,25 +176,39 @@ Default timezone for the calendar. ''; }; - calendar = mkOption { - default = { }; - description = '' - Configuration for a single calendar. Either a file or a URL must be provided. - This option is kept for backward compatibility. Using the calendars option - is recommended for new configurations. - - Note: This option is deprecated and will be removed in a future release. - ''; - type = calendarOptionType; - }; - calendars = mkOption { default = [ ]; description = '' Configuration for multiple calendars. This option will be appended to the singular calendar option if both are specified. ''; - type = types.listOf calendarOptionType; + type = types.listOf (types.submodule { + options = { + file = mkOption { + type = with types; nullOr str; + default = null; + example = "/path/to/calendar/file"; + description = '' + Path to the calendar file. Preferred over URL. + ''; + }; + url = mkOption { + type = with types; nullOr str; + default = null; + example = "https://example.com/calendar.ics"; + description = '' + URL to the calendar file. + ''; + }; + all_tentative = mkOption { + type = types.bool; + default = false; + description = '' + Whether all events from this calendar should be marked as tentative. + ''; + }; + }; + }); }; email = mkOption {@@ -243,16 +229,10 @@ # Validate configuration assertions = [ { assertion = with cfg.settings; - (calendars != [ ] && builtins.any (cal: cal.file != "" || cal.url != "") calendars) || - (calendar.file != "" || calendar.url != ""); - message = "At least one calendar must be configured with either a file or URL in either settings.calendar or settings.calendars"; + (calendars != [ ] && builtins.any (cal: cal.file != "" || cal.url != "") calendars); + message = "At least one calendar must be configured with either a file or URL in settings.calendars"; } ]; - - # Issue deprecation warning if the calendar option is used - warnings = lib.optional - (cfg.settings.calendar.file != "" || cfg.settings.calendar.url != "") - "The settings.calendar option is deprecated and will be removed in a future release. Please use the settings.calendars option instead."; systemd.services.mycal = { description = "Mycal Calendar Service";
M mycal.py → mycal.py
@@ -24,8 +24,7 @@ class Config(TomlDataClassIO): name: str email: str timezone: str - calendar: typing.Optional[CalendarConfig] = None # Keep for backward compatibility - calendars: typing.List[CalendarConfig] = field(default_factory=list) # New field for multiple calendars + calendars: typing.List[CalendarConfig] = field(default_factory=list) def load_config(file_path): with open(file_path, "r") as fr:@@ -125,18 +124,9 @@ busy.add('dtstart', start_date.astimezone(tz=utc)) busy.add('dtend', end_date.astimezone(tz=utc)) try: - calendars_to_process = [] busy_periods = {} - # For backward compatibility - if config.calendar is not None and (config.calendar['file'] != "" or config.calendar['url'] != ""): - calendars_to_process.append(config.calendar) - - # Add calendars from the new field if available - if config.calendars: - calendars_to_process.extend(config.calendars) - - for calendar_config in calendars_to_process: + for calendar_config in config.calendars: calendar_data = get_calendar(calendar_config) input_calendar = Calendar.from_ical(calendar_data)