2023-11-29 22:15:31 -05:00
|
|
|
{
|
|
|
|
caddy-plugins,
|
|
|
|
pkgs,
|
|
|
|
config,
|
|
|
|
...
|
|
|
|
}: let
|
2024-01-09 13:13:04 -05:00
|
|
|
inherit (config.vars) mainUser;
|
|
|
|
inherit (config.sops) secrets;
|
|
|
|
|
2023-11-29 22:15:31 -05:00
|
|
|
caddy = caddy-plugins.packages.${pkgs.system}.default;
|
2024-01-23 23:42:41 -05:00
|
|
|
|
2024-02-01 11:48:38 -05:00
|
|
|
clusterIP = config.services.pcsd.virtualIps.caddy-vip.ip;
|
2023-11-29 22:15:31 -05:00
|
|
|
in {
|
|
|
|
imports = [caddy-plugins.nixosModules.default];
|
2024-01-23 16:15:40 -05:00
|
|
|
|
|
|
|
# User stuff
|
2023-11-29 22:15:31 -05:00
|
|
|
environment.systemPackages = [caddy];
|
2024-01-09 13:13:04 -05:00
|
|
|
users.users.${mainUser}.extraGroups = ["caddy"];
|
2023-11-29 22:15:31 -05:00
|
|
|
|
2023-12-21 15:09:34 -05:00
|
|
|
systemd.services.caddy.serviceConfig = {
|
|
|
|
EnvironmentFile = secrets.caddy-cloudflare.path;
|
|
|
|
|
|
|
|
# For some reason the service
|
|
|
|
# doesn't shutdown normally
|
|
|
|
KillSignal = "SIGKILL";
|
|
|
|
RestartKillSignal = "SIGKILL";
|
|
|
|
};
|
2023-12-05 20:15:27 -05:00
|
|
|
|
2023-11-29 22:15:31 -05:00
|
|
|
services.caddy = {
|
|
|
|
enable = true;
|
|
|
|
enableReload = false;
|
|
|
|
package = caddy;
|
|
|
|
|
2023-12-21 15:09:34 -05:00
|
|
|
virtualHosts = let
|
|
|
|
dockerIP = "10.0.0.122";
|
|
|
|
jellyIP = "10.0.0.123";
|
2023-12-26 00:48:43 -05:00
|
|
|
servivi = "10.0.0.249";
|
2023-12-21 15:09:34 -05:00
|
|
|
in {
|
|
|
|
"nelim.org" = {
|
2023-11-29 22:15:31 -05:00
|
|
|
serverAliases = ["*.nelim.org"];
|
|
|
|
extraConfig = ''
|
|
|
|
tls {
|
2024-01-05 16:33:47 -05:00
|
|
|
dns cloudflare {$CLOUDFLARE_API_TOKEN}
|
2023-11-29 22:15:31 -05:00
|
|
|
resolvers 1.0.0.1
|
|
|
|
}
|
|
|
|
'';
|
|
|
|
|
|
|
|
subDomains = {
|
|
|
|
# Misc one-liners
|
2023-12-21 15:09:34 -05:00
|
|
|
vault.reverseProxy = "${dockerIP}:8781";
|
|
|
|
hauk.reverseProxy = "${dockerIP}:3003";
|
2024-01-23 23:42:41 -05:00
|
|
|
headscale.reverseProxy = "${clusterIP}:8085";
|
2023-11-29 22:15:31 -05:00
|
|
|
jelly.reverseProxy = "${jellyIP}:80";
|
|
|
|
|
|
|
|
# Resume builder
|
2023-12-21 15:09:34 -05:00
|
|
|
resume.reverseProxy = "${dockerIP}:3060";
|
|
|
|
resauth.reverseProxy = "${dockerIP}:3100";
|
2023-11-29 22:15:31 -05:00
|
|
|
|
|
|
|
# Nextcloud & Co
|
2024-02-23 00:43:16 -05:00
|
|
|
office.reverseProxy = "http://${servivi}:8055";
|
2023-11-29 22:15:31 -05:00
|
|
|
nextcloud = {
|
|
|
|
subDomainName = "cloud";
|
|
|
|
extraConfig = ''
|
|
|
|
redir /.well-known/carddav /remote.php/dav 301
|
|
|
|
redir /.well-known/caldav /remote.php/dav 301
|
|
|
|
redir /.well-known/webfinger /index.php/.well-known/webfinger 301
|
|
|
|
redir /.well-known/nodeinfo /index.php/.well-known/nodeinfo 301
|
|
|
|
'';
|
2024-02-23 00:43:16 -05:00
|
|
|
reverseProxy = "${servivi}:8042";
|
2023-11-29 22:15:31 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
forgejo = {
|
|
|
|
subDomainName = "git";
|
2024-01-07 04:37:11 -05:00
|
|
|
reverseProxy = "${servivi}:3000";
|
2023-11-29 22:15:31 -05:00
|
|
|
};
|
|
|
|
|
2023-12-26 00:48:43 -05:00
|
|
|
nix-binary-cache = {
|
|
|
|
subDomainName = "cache";
|
|
|
|
reverseProxy = "${servivi}:5000";
|
|
|
|
};
|
|
|
|
|
2023-11-29 22:15:31 -05:00
|
|
|
calibre = {
|
|
|
|
subDomainName = "books";
|
2023-12-21 15:09:34 -05:00
|
|
|
reverseProxy = "${dockerIP}:8083";
|
2023-11-29 22:15:31 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
immich = {
|
|
|
|
subDomainName = "photos";
|
2024-02-19 12:42:02 -05:00
|
|
|
reverseProxy = "${servivi}:2283";
|
2023-11-29 22:15:31 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
# FreshRSS & Co
|
2024-02-28 12:31:40 -05:00
|
|
|
drss.reverseProxy = "${servivi}:3007";
|
2023-11-29 22:15:31 -05:00
|
|
|
freshrss = {
|
|
|
|
subDomainName = "rss";
|
2024-02-28 12:31:40 -05:00
|
|
|
reverseProxy = "${servivi}:2800";
|
2023-11-29 22:15:31 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
jellyseer = {
|
|
|
|
subDomainName = "seerr";
|
2023-12-21 15:09:34 -05:00
|
|
|
reverseProxy = "${dockerIP}:5055";
|
2023-11-29 22:15:31 -05:00
|
|
|
};
|
|
|
|
|
2023-12-21 15:09:34 -05:00
|
|
|
games.reverseProxy = "${dockerIP}:8074";
|
2023-11-29 22:15:31 -05:00
|
|
|
|
|
|
|
# FIXME: what's the IP?
|
|
|
|
#wgui.extraConfig = ''
|
|
|
|
# reverse_proxy ???:51821
|
|
|
|
#'';
|
|
|
|
|
|
|
|
lan = {
|
2024-02-18 00:15:37 -05:00
|
|
|
reverseProxy = "${servivi}:3020";
|
2023-11-29 22:15:31 -05:00
|
|
|
extraConfig = ''
|
|
|
|
redir /index.html /
|
|
|
|
'';
|
|
|
|
|
|
|
|
subDirectories = {
|
2023-12-21 15:09:34 -05:00
|
|
|
bazarr.reverseProxy = "${dockerIP}:6767";
|
2023-11-29 22:15:31 -05:00
|
|
|
bazarr-french = {
|
|
|
|
subDirName = "bafrr";
|
2023-12-21 15:09:34 -05:00
|
|
|
reverseProxy = "${dockerIP}:6766";
|
2023-11-29 22:15:31 -05:00
|
|
|
};
|
|
|
|
|
2023-12-21 15:09:34 -05:00
|
|
|
prowlarr.reverseProxy = "${dockerIP}:9696";
|
|
|
|
radarr.reverseProxy = "${dockerIP}:7878";
|
|
|
|
sabnzbd.reverseProxy = "${dockerIP}:8382";
|
|
|
|
sonarr.reverseProxy = "${dockerIP}:8989";
|
2023-11-29 22:15:31 -05:00
|
|
|
|
|
|
|
calibre = {
|
|
|
|
experimental = true;
|
2023-12-21 15:09:34 -05:00
|
|
|
reverseProxy = "${dockerIP}:8580";
|
2023-11-29 22:15:31 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
qbittorent = {
|
|
|
|
subDirName = "qbt";
|
|
|
|
experimental = true;
|
2024-02-27 04:33:09 -05:00
|
|
|
reverseProxy = "${servivi}:8080";
|
2023-11-29 22:15:31 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
vaultwarden = {
|
|
|
|
subDirName = "vault";
|
|
|
|
experimental = true;
|
2023-12-21 15:09:34 -05:00
|
|
|
reverseProxy = "${dockerIP}:8780";
|
2023-11-29 22:15:31 -05:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
# Top secret Business
|
|
|
|
joal.extraConfig = ''
|
|
|
|
route {
|
|
|
|
rewrite * /joal/ui{uri}
|
2023-12-21 15:09:34 -05:00
|
|
|
reverse_proxy * ${dockerIP}:5656
|
2023-11-29 22:15:31 -05:00
|
|
|
}
|
|
|
|
'';
|
|
|
|
joalws.extraConfig = ''
|
|
|
|
route {
|
2023-12-21 15:09:34 -05:00
|
|
|
reverse_proxy ${dockerIP}:5656
|
2023-11-29 22:15:31 -05:00
|
|
|
}
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|