{ config, lib, pkgs, ... }: { programs = { vdirsyncer.enable = true; khal.enable = true; }; services.vdirsyncer.enable = true; accounts.calendar = { basePath = ".calendar"; accounts = let local = { type = "filesystem"; fileExt = ".ics"; }; in { nextcloud = rec { inherit local; primary = lib.mkDefault true; primaryCollection = "personal"; remote = { type = "caldav"; url = "https://cloud.xenia.me.uk/remote.php/dav"; userName = "xenia"; passwordCommand = [ "${pkgs.libsecret}/bin/secret-tool" "lookup" "url" "cloud.xenia.me.uk" ]; }; vdirsyncer = { enable = lib.mkDefault true; collections = [ "from a" ]; metadata = [ "color" "displayname" ]; }; khal = { inherit (vdirsyncer) enable; type = "discover"; }; }; outlook = let emailConfig = config.accounts.email.accounts.outlook; in rec { inherit local; primary = lib.mkDefault false; primaryCollection = "Work"; remote = rec { inherit (emailConfig) userName passwordCommand; type = "caldav"; url = "http://localhost:1080/users/${userName}/calendar/"; }; vdirsyncer = { enable = lib.mkDefault emailConfig.mbsync.enable; collections = [ "Work" "Operations" ]; metadata = [ "displayname" ]; }; khal = { inherit (vdirsyncer) enable; type = "discover"; }; }; outlook_ro = rec { inherit local; remote = { type = "http"; url = "https://outlook.office365.com/owa/calendar/57fac11ebefa4d76936bb57c58cea2c0@ukaea.uk/f00cf5046175418c881b15ae1734d35f4235780993826029606/S-1-8-4280276996-1465607807-3846002500-2142210095/reachcalendar.ics"; }; vdirsyncer = { enable = true; collections = null; }; khal = { inherit (vdirsyncer) enable; color = "dark blue"; type = "calendar"; readOnly = true; }; }; }; }; }