feat(linkal): Sync with metis on ens.cal.dgnum.eu

This commit is contained in:
sinavir 2023-10-23 11:35:28 +02:00 committed by thubrecht
parent c30d8961b9
commit ff9e582e70
2 changed files with 31 additions and 1 deletions

View file

@ -0,0 +1,24 @@
{ lib, pkgs }:
source:
let
#import metis stuff
metisCalendarData = builtins.fromJSON (builtins.readFile (source + /data/calendars.json));
calendars = metisCalendarData.sources;
inherit (import source { inherit pkgs; }) providers;
# helper function to map 2-level deep attribute-sets
mapDeepAttrs = mapFct:
lib.concatMapAttrs (name: value:
lib.mapAttrs' (name': value':
mapFct name name' value'
) value
);
toLinkal = upstream: identifier:
lib.nameValuePair
"https://${providers.${upstream}}/remote.php/dav/public-calendars/${identifier}"
;
in
mapDeepAttrs toLinkal calendars