forked from lukas/nixos-config
44 lines
1.6 KiB
Nix
44 lines
1.6 KiB
Nix
{config, lib, ... }:
|
|
|
|
let
|
|
mkRoute = { name, host, port, ip }: {
|
|
routers = {
|
|
"${name}" = {
|
|
rule = "Host(`${name}.${host}`)";
|
|
tls.certResolver = "cloudflare";
|
|
service = name;
|
|
entrypoints = "websecure";
|
|
};
|
|
};
|
|
|
|
services = {
|
|
"${name}".loadBalancer.servers = [
|
|
{ url = "http://${ip}:${toString port}/"; }
|
|
];
|
|
};
|
|
};
|
|
|
|
routes = [
|
|
{ name = "data"; host = "${config.domain}"; port = 8011; ip = "127.0.0.1"; }
|
|
{ name = "social"; host = "${config.domain}"; port = 8020; ip = config.tailnetIPs.pinix; }
|
|
{ name = "phanpy"; host = "${config.domain}"; port = 8004; ip = config.tailnetIPs.pinix; }
|
|
{ name = "board"; host = "${config.domain}"; port = 8026; ip = config.tailnetIPs.pinix; }
|
|
#{ name = "git"; host = "${config.domain}"; port = 3000 ; ip = "127.0.0.1"; }
|
|
{ name = "lldap"; host = "${config.domain}"; port = 17170 ; ip = "127.0.0.1"; }
|
|
#has it's own .nix file { name = "dex"; host = "${config.domain}"; port = 5556 ; ip = "127.0.0.1"; }
|
|
{ name = "head"; host = "${config.domain}"; port = 3001 ; ip = "127.0.0.1"; }
|
|
{ name = "hdm"; host = "${config.domain}"; port = 8055; ip = "127.0.0.1"; }
|
|
#fastpi
|
|
{ name = "abs"; host = "${config.domain}"; port = 13378 ; ip = config.tailnetIPs.fastpi; }
|
|
{ name = "mealie"; host = "${config.domain}"; port = 9925; ip = config.tailnetIPs.fastpi; }
|
|
{ name = "trek"; host = "${config.domain}"; port = 3024; ip = config.tailnetIPs.fastpi; }
|
|
];
|
|
|
|
combinedHttp = builtins.foldl'
|
|
(acc: route: lib.recursiveUpdate acc (mkRoute route))
|
|
{}
|
|
routes;
|
|
|
|
in {
|
|
services.traefik.dynamicConfigOptions.http = combinedHttp;
|
|
}
|