diff options
| author | Collin Williams <96917990+bluedragon1221@users.noreply.github.com> | 2026-02-10 15:49:15 -0600 |
|---|---|---|
| committer | Collin Williams <96917990+bluedragon1221@users.noreply.github.com> | 2026-02-10 15:49:15 -0600 |
| commit | ed84fb332431c6c33891ac1b18a0b184e7d828be (patch) | |
| tree | c9ea705ccf7e522eea8e0f6903e35efb9401ac78 /modules/services/nixos/mkCaddyCfg.nix | |
| parent | 4faf9d617a1038fc72dd5add6fd25da1a1fbda3d (diff) | |
deprecate unmaintained services
Diffstat (limited to 'modules/services/nixos/mkCaddyCfg.nix')
| -rw-r--r-- | modules/services/nixos/mkCaddyCfg.nix | 45 |
1 files changed, 32 insertions, 13 deletions
diff --git a/modules/services/nixos/mkCaddyCfg.nix b/modules/services/nixos/mkCaddyCfg.nix index bb2e06d..d7b74c0 100644 --- a/modules/services/nixos/mkCaddyCfg.nix +++ b/modules/services/nixos/mkCaddyCfg.nix @@ -1,15 +1,34 @@ cfg: { - services.caddy = - if cfg.caddy.enable - then { - virtualHosts.${cfg.root_url}.extraConfig = '' - ${ - if cfg.caddy.bind_tailscale - then "bind tailscale/${cfg.service_name}" - else "" - } - reverse_proxy ${cfg.bind_host}:${toString cfg.port} - ''; - } - else {}; + networking.extraHosts = + if cfg.caddy.local.enable + then '' + 127.0.0.1 ${cfg.service_name}.collinux + '' + else ""; + + services.caddy.virtualHosts = + ( + if cfg.caddy.global.enable && (cfg.root_url != null) + then { + ${cfg.root_url}.extraConfig = '' + ${ + if cfg.caddy.bind_tailscale + then "bind tailscale/${cfg.service_name}" + else "" + } + reverse_proxy ${cfg.bind_host}:${toString cfg.port} + ''; + } + else {} + ) + // ( + if cfg.caddy.local.enable + then { + "${cfg.service_name}.collinux".extraConfig = '' + tls internal + reverse_proxy ${cfg.bind_host}:${toString cfg.port} + ''; + } + else {} + ); } |
