diff options
| author | Valentin <valentin@fricklerhandwerk.de> | 2025-12-20 18:22:16 +0100 |
|---|---|---|
| committer | Valentin <valentin@fricklerhandwerk.de> | 2025-12-22 19:08:55 +0100 |
| commit | e2f0ca2c8c56600ae148c307b59b280abc1ff8b0 (patch) | |
| tree | d1ba550d933a6b6d65cda096361ece4b9253621c | |
| parent | 8b0a011c7c37d882a2e12ea8de38acaa9e782d38 (diff) | |
Datentyp für Termine
| -rw-r--r-- | www/framework/default.nix | 8 | ||||
| -rw-r--r-- | www/framework/event.nix | 181 |
2 files changed, 189 insertions, 0 deletions
diff --git a/www/framework/default.nix b/www/framework/default.nix index 0cc9049..e202361 100644 --- a/www/framework/default.nix +++ b/www/framework/default.nix @@ -32,6 +32,14 @@ in type = with types; attrsOf (either path (submodule config.types.file)); }; + events = mkOption { + description = '' + Termine + ''; + type = with types; attrsOf (submodule config.types.event); + default = { }; + }; + redirects.raw = mkOption { description = '' Weiterleitungen aller historischen Dateipfade auf Kanonische Pfade diff --git a/www/framework/event.nix b/www/framework/event.nix new file mode 100644 index 0000000..7dea810 --- /dev/null +++ b/www/framework/event.nix @@ -0,0 +1,181 @@ +{ config, ... }: +{ + config.types.event = + event@{ lib, ... }: + let + inherit (lib) mkOption types; + in + { + imports = [ config.types.document ]; + options = { + title = mkOption { + description = '' + Übeschrift für den Termin + ''; + type = types.singleLineStr; + }; + summary = mkOption { + description = '' + Kurzbeschreibung des Termins + ''; + type = with types; nullOr singleLineStr; + default = null; + }; + aside = mkOption { + description = '' + Anmerkung zur Beschreibung + ''; + type = with types; nullOr singleLineStr; + default = null; + }; + description = mkOption { + description = '' + Beschreibung des Termins als Freitext + ''; + type = with types; nullOr str; + default = null; + }; + data = mkOption { + description = '' + Semistrukturierte Daten über den Termin + ''; + type = + with types; + listOf (submodule { + options = { + name = mkOption { + type = singleLineStr; + }; + value = mkOption { + type = singleLineStr; + }; + }; + }); + example = [ + { + name = "Eintritt"; + value = "frei – um Spenden wird gebeten"; + } + ]; + default = [ ]; + }; + links = mkOption { + description = '' + Links zu weiteren Informationen + ''; + type = + with types; + listOf (submodule { + options = { + text = mkOption { + type = singleLineStr; + }; + url = mkOption { + type = strMatching "^(([^:/?#]+):)(//([^/?#]*))([^?#]*)(\\?([^#]*))?(#(.*))?"; + }; + external = mkOption { + type = bool; + default = true; + }; + }; + }); + default = [ ]; + example = { + text = "Details beim Veranstalter"; + url = "https://examle.org/event/123"; + }; + }; + hosts = mkOption { + description = '' + Veranstalter + ''; + type = + with types; + listOf (submodule { + options = { + name = mkOption { + type = singleLineStr; + }; + url = mkOption { + type = strMatching "^(([^:/?#]+):)(//([^/?#]*))([^?#]*)(\\?([^#]*))?(#(.*))?"; + }; + }; + }); + default = [ ]; + example = { + name = "Stadtteilbeirat Heimfeld"; + url = "https://heimfeld.harburg"; + }; + }; + date.start = mkOption { + description = '' + Datum des Termins + ''; + type = types.strMatching "[0-9]{4}-[0-9]{2}-[0-9]{2}"; + example = "2025-12-20"; + }; + date.end = mkOption { + description = '' + Enddatum des Termins + ''; + type = with types; nullOr (strMatching "[0-9]{4}-[0-9]{2}-[0-9]{2}"); + example = "2025-12-21"; + default = null; + }; + time.start = mkOption { + description = '' + Startzeit des Termins + ''; + type = types.strMatching "[0-9]{2}:[0-9]{2}"; + example = "17:00"; + }; + time.end = mkOption { + description = '' + Endzeit des Termins + ''; + type = with types; nullOr (strMatching "[0-9]{2}:[0-9]{2}"); + example = "19:00"; + default = null; + }; + datetime-range-text = mkOption { + description = '' + Zeitraum des Termins in Textform + ''; + type = types.str; + example = "Samstag, 20.12.2025 von 15:00 bis 17:00 Uhr"; + }; + address.name = mkOption { + description = '' + Eigenname des Veranstaltungsorts + ''; + type = with types; nullOr str; + example = "Treffpunkthaus"; + default = null; + }; + address.text = mkOption { + description = '' + Ort in Textform + ''; + type = types.lines; + }; + address.openstreetmap = mkOption { + description = '' + Ort auf OpenStreetMap + ''; + type = + with types; + attrTag { + way = mkOption { + type = ints.positive; + }; + node = mkOption { + type = ints.positive; + }; + }; + example = { + node = 6549438363; + }; + }; + }; + }; +} |
