diff --git a/users/simon/modules/vdirsyncer.nix b/users/simon/modules/vdirsyncer.nix index 31b6996..03121bf 100644 --- a/users/simon/modules/vdirsyncer.nix +++ b/users/simon/modules/vdirsyncer.nix @@ -43,6 +43,28 @@ let "password.fetch" = fetchCommand passwordCommand; }; }; + + mkWebcalSection = { name, url ? null, urlCommand ? null }: assert url == null -> urlCommand != null; { + "pair calendar_${name}" = { + a = "calendar_${name}_local"; + b = "calendar_${name}_remote"; + collections = null; + }; + + "storage calendar_${name}_local" = { + type = "filesystem"; + path = "${calendarBasePath}/${name}/"; + fileext = ".ics"; + }; + + "storage calendar_${name}_remote" = { + type = "http"; + } // (if urlCommand != null then { + "url.fetch" = fetchCommand urlCommand; + } else { + inherit url; + }); + }; in { home.packages = with pkgs; [ @@ -75,6 +97,10 @@ in username = "simon@sbruder.de"; passwordCommand = "pass sbruder.de/mail | head -n 1"; }) + (mkWebcalSection { + name = "grocy"; + urlCommand = [ "pass" "sbruder.de/grocy/calendar" ]; + }) ]); "khal/config".text = /* toml */ '' @@ -88,6 +114,9 @@ in path = ${contactsBasePath}/personal/${personalContactsUuid}/ type = birthdays + [[calendar_grocy]] + path = ${calendarBasePath}/grocy/ + [locale] timeformat = %H:%M dateformat = %Y-%m-%d