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

Merged
thubrecht merged 1 commit from add_metis_to_linkal_2 into main 2023-10-27 14:37:35 +02:00
2 changed files with 31 additions and 1 deletions

View file

@ -1,8 +1,10 @@
_: { sources, pkgs, lib, ... }:
let let
host = "cal.dgnum.eu"; host = "cal.dgnum.eu";
metis2linkal = import ./metis-to-linkal.nix { inherit pkgs lib; };
calendarGroups = { calendarGroups = {
luj-current = { luj-current = {
port = 8444; port = 8444;
@ -19,6 +21,10 @@ let
}; };
}; };
}; };
ens = {
port = 8445;
calendars = metis2linkal sources.metis;
};
}; };
in { in {
imports = [ ./module.nix ]; imports = [ ./module.nix ];

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