{ self, ... }: { perSystem = { ... }: { websites.${self.domain} = { config, lib, ... }: let inherit (lib) mkOption types; root = ./html; files = with lib.fileset; toList ( difference (fileFilter (file: file.hasExt "html" || file.hasExt "js") root) ./html/Kalender ); replacements = let events = with lib; let as-list = mapAttrsToList (name: value: { slug = name; start = value.date.start + value.time.start; value = toString value; }) config.events; in sortOn (event: event.start) as-list; in { "@title@" = config.title; "@published@" = config.published; "@stylesheet@" = ''''; "@head@" = '' ''; "@past-events@" = ''
${ with lib; concatMapStringsSep "\n" (event: event.value) ( filter (event: event.start < config.published) (reverseList events) ) }
''; "@future-events@" = ''
${ with lib; concatMapStringsSep "\n" (event: event.value) ( filter (event: event.start >= config.published) events ) }
''; "@events-redirects@" = with lib; concatMapStringsSep ",\n" (event: ''"${event.slug}": "vergangene-termine.html#${event.slug}"'') (filter (event: event.start < config.published) (reverseList events)); }; replace = file: with lib; replaceStrings (attrNames replacements) (attrValues replacements) file; in { title = "Stadtteilbeirat Heimfeld"; published = "2026-01-24"; events = with lib; listToAttrs ( map (file: { name = removeSuffix ".nix" (toString (baseNameOf file)); value = import file; }) (fileset.toList ./termine) ); files = with lib; listToAttrs ( map (path: { name = lib.path.removePrefix root path; value = with builtins; toFile (baseNameOf path) (replace (readFile path)); }) files ); }; }; }