diff --git a/system/services/caddy.nix b/system/services/caddy.nix index 51fa728..1f6a910 100644 --- a/system/services/caddy.nix +++ b/system/services/caddy.nix @@ -1,4 +1,4 @@ -{ config, lib, ... }: +{ config, lib, unstable, ... }: let cfg = config.profile.services.caddy; inherit (lib) mkIf attrsets strings lists; @@ -7,6 +7,7 @@ in config = mkIf cfg.enable { services.caddy = { enable = true; + package = unstable.caddy; }; services.caddy.globalConfig = /*caddy*/ '' @@ -15,36 +16,44 @@ in } ''; + environment.etc."caddy/static/tigor.web.id/index.html" = { + text = + 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; + in + /*html*/ '' + + + + Hosted Sites + + + +

Hosted Sites

+
+ ${items} +
+ + + ''; + user = "caddy"; + group = "caddy"; + }; + services.caddy.virtualHosts = - 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 { "router.tigor.web.id".extraConfig = '' @denied not remote_ip private_ranges @@ -55,17 +64,13 @@ in ''; "tigor.web.id".extraConfig = '' - header Content-Type text/html - respond <