Files
nixos-configuration/hosts/pi4/caddy.nix

86 lines
2.2 KiB
Nix
Raw Normal View History

{ common, ... }:
let
domain = common.domain;
in
{
services.caddy = {
enable = true;
email = "cert@${domain}";
virtualHosts =
let
reverseProxy = port: "reverse_proxy localhost:${builtins.toString port}";
redirect = subdomain: "redir https://${subdomain}.${domain}{uri}";
in
{
"beta.${domain}".extraConfig = ''
redir https://${domain}{uri}
'';
"git.${domain}".extraConfig = ''
${redirect "code"}
'';
"kitchenowl.${domain}".extraConfig = ''
${redirect "grocery"}
'';
# Gitea
"code.${domain}".extraConfig = ''
${reverseProxy 3000}
'';
# Nextcloud
"nextcloud.${domain}".extraConfig = ''
redir /.well-known/carddav /remote.php/dav 301
redir /.well-known/caldav /remote.php/dav 301
${reverseProxy 11000}
'';
# Kitchenowl
"grocery.${domain}".extraConfig = ''
${reverseProxy 800}
'';
# Actual Budget
"budget.${domain}".extraConfig = ''
${reverseProxy 5006}
'';
# Uptime Kuma
"status.${domain}".extraConfig = ''
${reverseProxy 3001}
'';
# Headscale
"vpn.${domain}".extraConfig = ''
reverse_proxy /web* localhost:8084
reverse_proxy * localhost:8082
'';
# Headscale SmartDNS
"dns.${domain}".extraConfig = ''
${reverseProxy 8082}
'';
# FreshRSS
"rss.${domain}".extraConfig = ''
${reverseProxy 8085}
'';
# Ente backend
"api.ente.${domain}".extraConfig = ''
${reverseProxy 8083}
'';
# Ente Photos frontend
"ente.${domain}".extraConfig = ''
${reverseProxy 3003}
'';
# Ente Auth frontend
"mfa.${domain}".extraConfig = ''
${reverseProxy 3004}
'';
# Homepage / portfolio
"${domain}".extraconfig = ''
${reverseProxy 4321}
'';
# Yamtrack
"track.${domain}".extraConfig = ''
${reverseProxy 8090}
'';
# Postal
"mail.${domain}".extraConfig = ''
${reverseProxy 5000}
'';
};
};
}