{ config, lib, ... }: let cfg = config.profile.services.caddy; inherit (lib) mkIf attrsets strings lists; in { config = mkIf cfg.enable { services.caddy = { enable = true; }; services.caddy.virtualHosts."router.tigor.web.id".extraConfig = '' @denied not remote_ip private_ranges respond @denied "Access denied" 403 reverse_proxy 192.168.100.1 ''; services.caddy.virtualHosts."tigor.web.id".extraConfig = let domains = attrsets.mapAttrsToList (name: _: strings.removePrefix "https://" name) config.services.caddy.virtualHosts; sortedDomains = lists.sort (a: b: a < b) domains; list = map (domain: /*html*/ ''
${domain}
'') sortedDomains; items = strings.concatStringsSep "\n" list; html = /*html*/ '' Hosted Sites

Hosted Sites

${items}
''; in '' header Content-Type text/html respond <