refactor: реестр адресов флота lib/xlib/net.nix

Один адрес — одно имя. Раньше 192.168.1.20 был написан 41 раз, 100.64.0.0
— семь, а зона CoreDNS и vhost'ы nginx жили в разных файлах и разъезжались
(например, kuma.zeroq.su остался в DNS после отключения uptime-kuma).

Реестр: хосты (LAN/tailscale/public), публичные DNS, сети, общие порты.
Все хардкоды адресов флота переведены на xlib.net.*.

Намеренно не тронуто: 127.0.0.1 и 0.0.0.0 (константы языка, не топология),
сеть 10.66.0.0/24 (у PXE-инфраструктуры своя опционная поверхность) и
home/modules/opencode.nix (рабочая конфигурация агента владельца, её
рефакторинг запрещён ADR-0009).

Поведение не изменилось: config-fingerprint до/после совпадает по всем
шести хостам.
This commit is contained in:
oqyude committed 2026-11-15 06:34:12 +03:00
1 parent 53df473609
commit 0ab45578d1
11 files changed
+225 -80

No files matched your search

+3 -3
View File
@@ -70,7 +70,7 @@ in
"--network=taperotation_default"
# Static IP the frontend reaches "backend" at (see --add-host
# in the frontend container; network DNS is disabled).
"--ip=10.89.0.10"
"--ip=${xlib.net.containerHosts.tapeRotationBackend}"
];
};
"taperotation-frontend" = {
@@ -83,7 +83,7 @@ in
"--network=taperotation_default"
# Baked-in nginx upstream is http://backend:8001; resolve it via
# /etc/hosts since the network has no DNS plugin.
"--add-host=backend:10.89.0.10"
"--add-host=backend:${xlib.net.containerHosts.tapeRotationBackend}"
];
};
};
@@ -144,7 +144,7 @@ in
# backend's static IP. Recreate-on-start also self-heals after a
# `podman system prune` removed the (temporarily unused) network.
podman network rm -f taperotation_default >/dev/null 2>&1 || true
podman network create --disable-dns --subnet=10.89.0.0/24 taperotation_default
podman network create --disable-dns --subnet=${xlib.net.networks.podmanTapeRotation} taperotation_default
'';
partOf = [ "podman-compose-tape-rotation-root.target" ];
wantedBy = [ "podman-compose-tape-rotation-root.target" ];
+45 -38
View File
@@ -1,34 +1,41 @@
{
config,
pkgs,
xlib,
...
}:
# CoreDNS — the authoritative server for the `zeroq.su` (public) and
# `home.arpa` (LAN-only) zones.
#
# Every address here comes from the fleet registry (lib/xlib/net.nix): the
# zone and the nginx vhosts have to agree, and a DHCP lease that moved must
# not leave half of the zone pointing at the old machine.
{
services.coredns = {
enable = true;
config = ''
zeroq.su:53 {
hosts {
109.248.161.5 x.zeroq.su
192.168.1.20 authelia.zeroq.su
192.168.1.20 calibre.zeroq.su
192.168.1.20 dns.zeroq.su
192.168.1.20 flux.zeroq.su
192.168.1.20 git.zeroq.su
192.168.1.20 glances.zeroq.su
192.168.1.20 herdr.zeroq.su
192.168.1.20 homebox.zeroq.su
192.168.1.20 immich.zeroq.su
192.168.1.20 kuma.zeroq.su
192.168.1.20 navidrome.zeroq.su
192.168.1.20 nextcloud.zeroq.su
192.168.1.20 open.zeroq.su
192.168.1.20 office.zeroq.su
192.168.1.20 pdf.zeroq.su
192.168.1.20 syncthing.zeroq.su
192.168.1.20 talk.zeroq.su
192.168.1.20 turn.zeroq.su
192.168.1.20 vtimeline.zeroq.su
${xlib.net.hosts.otreca.public} x.zeroq.su
${xlib.net.hosts.sapphira.lan} authelia.zeroq.su
${xlib.net.hosts.sapphira.lan} calibre.zeroq.su
${xlib.net.hosts.sapphira.lan} dns.zeroq.su
${xlib.net.hosts.sapphira.lan} flux.zeroq.su
${xlib.net.hosts.sapphira.lan} git.zeroq.su
${xlib.net.hosts.sapphira.lan} glances.zeroq.su
${xlib.net.hosts.sapphira.lan} herdr.zeroq.su
${xlib.net.hosts.sapphira.lan} homebox.zeroq.su
${xlib.net.hosts.sapphira.lan} immich.zeroq.su
${xlib.net.hosts.sapphira.lan} kuma.zeroq.su
${xlib.net.hosts.sapphira.lan} navidrome.zeroq.su
${xlib.net.hosts.sapphira.lan} nextcloud.zeroq.su
${xlib.net.hosts.sapphira.lan} open.zeroq.su
${xlib.net.hosts.sapphira.lan} office.zeroq.su
${xlib.net.hosts.sapphira.lan} pdf.zeroq.su
${xlib.net.hosts.sapphira.lan} syncthing.zeroq.su
${xlib.net.hosts.sapphira.lan} talk.zeroq.su
${xlib.net.hosts.sapphira.lan} turn.zeroq.su
${xlib.net.hosts.sapphira.lan} vtimeline.zeroq.su
fallthrough
}
cache 300
@@ -36,30 +43,30 @@
}
home.arpa:53 {
hosts {
192.168.1.100 vetymae.home.arpa
192.168.1.20 ca.home.arpa
192.168.1.20 calibre.home.arpa
192.168.1.20 dns.home.arpa
192.168.1.20 flux.home.arpa
192.168.1.20 git.home.arpa
192.168.1.20 glances.home.arpa
192.168.1.20 home.arpa
192.168.1.20 homebox.home.arpa
192.168.1.20 immich.home.arpa
192.168.1.20 kuma.home.arpa
192.168.1.20 navidrome.home.arpa
192.168.1.20 nextcloud.home.arpa
192.168.1.20 office.home.arpa
192.168.1.20 pdf.home.arpa
192.168.1.20 sapphira.home.arpa
192.168.1.20 syncthing.home.arpa
${xlib.net.hosts.vetymae.lan} vetymae.home.arpa
${xlib.net.hosts.sapphira.lan} ca.home.arpa
${xlib.net.hosts.sapphira.lan} calibre.home.arpa
${xlib.net.hosts.sapphira.lan} dns.home.arpa
${xlib.net.hosts.sapphira.lan} flux.home.arpa
${xlib.net.hosts.sapphira.lan} git.home.arpa
${xlib.net.hosts.sapphira.lan} glances.home.arpa
${xlib.net.hosts.sapphira.lan} home.arpa
${xlib.net.hosts.sapphira.lan} homebox.home.arpa
${xlib.net.hosts.sapphira.lan} immich.home.arpa
${xlib.net.hosts.sapphira.lan} kuma.home.arpa
${xlib.net.hosts.sapphira.lan} navidrome.home.arpa
${xlib.net.hosts.sapphira.lan} nextcloud.home.arpa
${xlib.net.hosts.sapphira.lan} office.home.arpa
${xlib.net.hosts.sapphira.lan} pdf.home.arpa
${xlib.net.hosts.sapphira.lan} sapphira.home.arpa
${xlib.net.hosts.sapphira.lan} syncthing.home.arpa
fallthrough
}
cache 300
log
}
.:53 {
forward . 192.168.1.1 1.1.1.1
forward . ${xlib.net.hosts.router.lan} ${xlib.net.dns.cloudflare}
cache 300
}
'';
+4 -3
View File
@@ -1,6 +1,7 @@
{
config,
lib,
xlib,
...
}:
# engipy — frontend-only nginx vhost для sapphira.
@@ -54,12 +55,12 @@ in
backendHost = lib.mkOption {
type = lib.types.str;
default = "192.168.1.102";
default = xlib.net.hosts.rydiwo.lan;
example = "rydiwo.lan";
description = ''
Хост, где крутится uvicorn (engipy-backend). По умолчанию
rydiwo — 192.168.1.102 в LAN. По этому адресу nginx проксирует
/api/* внутри vhost'а.
rydiwo — его LAN-адрес из реестра флота (lib/xlib/net.nix).
По этому адресу nginx проксирует /api/* внутри vhost'а.
'';
};
+7 -7
View File
@@ -78,9 +78,9 @@ in
settings = {
log_type = "file";
trusted_domains = [
"100.64.0.0"
"192.168.1.20"
"37.128.246.126"
xlib.net.hosts.sapphira.tailscale
xlib.net.hosts.sapphira.lan
xlib.net.hosts.router.public
"localhost"
"nextcloud.home.arpa"
"nextcloud.private"
@@ -89,10 +89,10 @@ in
"office.zeroq.su"
];
trusted_proxies = [
"100.64.1.0"
"109.248.161.5"
"192.168.1.20"
"37.128.246.126"
xlib.net.hosts.otreca.tailscale
xlib.net.hosts.otreca.public
xlib.net.hosts.sapphira.lan
xlib.net.hosts.router.public
];
overwriteprotocol = "https"; # maybe no
};
+18 -16
View File
@@ -9,7 +9,9 @@
# x.zeroq.su is the 3x-ui controller panel — see 3x-ui.nix for the
# /subs/, /subsjs/, /clash/ routing logic.
let
server = "192.168.1.20";
# Upstream host for the `sites` list below — the LAN address of the home
# server, from the fleet registry (lib/xlib/net.nix).
server = xlib.net.hosts.sapphira.lan;
mkProxy =
{
@@ -113,11 +115,11 @@ in
enableACME = false;
listen = [
{
addr = "100.64.0.0";
addr = xlib.net.hosts.sapphira.tailscale;
port = 10000;
}
{
addr = "192.168.1.20";
addr = xlib.net.hosts.sapphira.lan;
port = 10000;
}
{
@@ -174,7 +176,7 @@ in
"= /authelia" = {
extraConfig = ''
internal;
proxy_pass http://127.0.0.1:9091/api/authz/forward-auth;
proxy_pass http://127.0.0.1:${toString xlib.net.ports.authelia}/api/authz/forward-auth;
# Never forward the client request body to the auth
# subrequest. nginx relays the original Content-Length to
# /authelia but does not relay the body itself, so Authelia
@@ -236,7 +238,7 @@ in
"= /authelia" = {
extraConfig = ''
internal;
proxy_pass http://127.0.0.1:9091/api/authz/forward-auth;
proxy_pass http://127.0.0.1:${toString xlib.net.ports.authelia}/api/authz/forward-auth;
# Never forward the client request body to the auth
# subrequest. nginx relays the original Content-Length to
# /authelia but does not relay the body itself, so Authelia
@@ -291,7 +293,7 @@ in
enableACME = true;
locations = {
"/" = {
proxyPass = "http://192.168.1.100:8083";
proxyPass = "http://${xlib.net.hosts.vetymae.lan}:8083";
proxyWebsockets = true;
extraConfig = ''
auth_request /authelia;
@@ -311,7 +313,7 @@ in
"= /authelia" = {
extraConfig = ''
internal;
proxy_pass http://127.0.0.1:9091/api/authz/forward-auth;
proxy_pass http://127.0.0.1:${toString xlib.net.ports.authelia}/api/authz/forward-auth;
# Тело запроса в subrequest не отправляем: Authelia решает по
# заголовкам, а без этого он ждёт байты, которых не будет, и
# отвечает 408 — статус, который auth_request не классифицирует
@@ -432,7 +434,7 @@ in
forceSSL = true;
enableACME = true;
locations."/" = {
proxyPass = "http://127.0.0.1:9091";
proxyPass = "http://127.0.0.1:${toString xlib.net.ports.authelia}";
proxyWebsockets = true;
};
};
@@ -445,11 +447,11 @@ in
port = 80;
}
{
addr = "100.64.0.0";
addr = xlib.net.hosts.sapphira.tailscale;
port = 8446;
}
{
addr = "192.168.1.20";
addr = xlib.net.hosts.sapphira.lan;
port = 8446;
}
{
@@ -536,7 +538,7 @@ in
forceSSL = true;
enableACME = true;
locations."/" = {
proxyPass = "http://192.168.1.100:4096";
proxyPass = "http://${xlib.net.hosts.vetymae.lan}:${toString xlib.net.ports.opencode}";
proxyWebsockets = true;
};
};
@@ -544,7 +546,7 @@ in
forceSSL = true;
enableACME = true;
locations."/" = {
proxyPass = "http://100.106.21.39:4096";
proxyPass = "http://${xlib.net.hosts.lamet.tailscale}:${toString xlib.net.ports.opencode}";
proxyWebsockets = true;
};
};
@@ -571,7 +573,7 @@ in
forceSSL = true;
enableACME = true;
locations."/" = {
proxyPass = "http://100.125.228.63:4096";
proxyPass = "http://${xlib.net.hosts.etherea.tailscale}:${toString xlib.net.ports.opencode}";
proxyWebsockets = true;
};
};
@@ -586,7 +588,7 @@ in
forceSSL = true;
enableACME = true;
locations."/" = {
proxyPass = "http://100.86.134.111:4096";
proxyPass = "http://${xlib.net.hosts.dejavu.tailscale}:${toString xlib.net.ports.opencode}";
proxyWebsockets = true;
};
};
@@ -607,7 +609,7 @@ in
forceSSL = true;
enableACME = true;
locations."/" = {
proxyPass = "http://100.92.238.19:4096";
proxyPass = "http://${xlib.net.hosts.rydiwo.tailscale}:${toString xlib.net.ports.opencode}";
proxyWebsockets = true;
};
};
@@ -618,7 +620,7 @@ in
forceSSL = true;
enableACME = true;
locations."/" = {
proxyPass = "http://127.0.0.1:4096";
proxyPass = "http://127.0.0.1:${toString xlib.net.ports.opencode}";
proxyWebsockets = true;
};
};
+1 -1
View File
@@ -7,7 +7,7 @@
}:
let
serviceName = "rsync-services-sync";
serverAddress = "${xlib.device.username}@100.64.0.0";
serverAddress = "${xlib.device.username}@${xlib.net.hosts.sapphira.tailscale}";
serverDir = "${xlib.dirs.services-nodes-folder}/${xlib.device.hostname}";
nodeDir = "${xlib.dirs.services-mnt-folder}";
in