diff --git a/system/services/caddy.nix b/system/services/caddy.nix index 6a6df5c..5ecf13a 100644 --- a/system/services/caddy.nix +++ b/system/services/caddy.nix @@ -1,7 +1,7 @@ { config, lib, ... }: let cfg = config.profile.services.caddy; - inherit (lib) mkIf; + inherit (lib) mkIf attrsets strings lists; in { config = mkIf cfg.enable { @@ -16,5 +16,36 @@ in 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 <