From a44365cdbdc1444416b279d5df7a396bdadd1093 Mon Sep 17 00:00:00 2001 From: Valentin Date: Mon, 22 Dec 2025 19:08:49 +0100 Subject: Bestehende Termine in strukturierte Daten umgewandelt --- www/termine.nix | 134 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 134 insertions(+) create mode 100644 www/termine.nix (limited to 'www/termine.nix') diff --git a/www/termine.nix b/www/termine.nix new file mode 100644 index 0000000..331f284 --- /dev/null +++ b/www/termine.nix @@ -0,0 +1,134 @@ +{ self, ... }: +{ + perSystem = + { ... }: + { + websites.${self.domain} = + { lib, ... }: + let + inherit (lib) mkOption types; + in + { + options = { + # Erweiterung zwecks ad-hoc tempplating + events = mkOption { + type = + with types; + attrsOf ( + submodule ( + { name, ... }: + { + options.name = mkOption { + type = str; + readOnly = true; + default = name; + }; + options.__toString = mkOption { + type = functionTo str; + readOnly = true; + default = self: '' +
${self.title}
+
+ + +
+ ${self.address.name}
+ ${with lib; concatStringsSep ", " (splitString "\n" (trim self.address.text))} +
+ + ${ + if !isNull self.summary then + '' +
${self.summary} + ${self.description} +
+ '' + else if !isNull self.description then + '' + ${self.description} + '' + else + "" + } + + ${lib.optionalString (!isNull self.aside) ''''} + + ${ + with lib; + optionalString (self.data != [ ]) '' +
+ ${concatMapStringsSep "\n" (entry: '' +
${entry.name}
+
${entry.value}
+ '') self.data} +
+ '' + } + + ${ + with lib; + let + print-host = host: ''${host.name}''; + in + if self.hosts == [ ] then + "" + else if length self.hosts == 1 then + '' +

Veranstalter: ${print-host (head self.hosts)}

+ '' + else + '' +

Veranstalter: +

+

+ '' + } + + ${ + with lib; + let + print-link = + link: + ''${link.text}''; + in + if self.links == [ ] then + "" + else if length self.links == 1 then + '' +

Weitere Informationen: ${print-link (head self.links)}

+ '' + else + '' +

Weitere Informationen: +

+

+ '' + } +
+ ''; + }; + } + ) + ); + }; + }; + }; + }; +} -- cgit v1.2.3