let lib = import ; mapFileNameToContent = fileName: { status = 200; contentType = "text/html"; content = builtins.readFile fileName; }; findFiles = dir: let content = builtins.readDir dir; processEntry = name: type: if type == "directory" then findFiles (dir + "/${name}") else if type == "regular" then [ (dir + "/${name}") ] else []; in lib.concatLists (lib.mapAttrsToList processEntry content); removePrefix = str: prefix: if builtins.substring 0 (builtins.stringLength prefix) str == prefix then builtins.substring (builtins.stringLength prefix) (builtins.stringLength str - builtins.stringLength prefix) str else str; contentFn = basePath: let files = findFiles basePath; baseLength = builtins.stringLength basePath; files' = builtins.filter (file: builtins.match ".*\\.html$" file != null) files; in builtins.listToAttrs (map (file: { name = removePrefix file basePath; value = mapFileNameToContent file; }) files'); in rec { "web.nudelerde.de" = contentFn "/etc/nixos/data/web/"; }