домены: реестр xlib.net.domains + синхронизация webDomain 3x-ui (T63, ADR-0012)
nixos flake checks / invariant-checks (push) Successful in 1m44s
test-runner / smoke (push) Successful in 1s

- lib/xlib/net.nix: domains.public/opencodes/internal/ad; все живые
  хостнеймы выводятся из реестра (nginx, coredns, authelia, nextcloud,
  gitea, vds, netbird, open-webui, opencode, nix-cache). Литералы — только
  в комментариях/example/email/trusted-key и в БД панели.
- 3xui-domain-sync.service: before+wantedBy podman-3xui_app, идемпотентно
  приводит settings.webDomain к host."3x-ui".certDomain ДО старта панели
  (R1.19/инвариант 19); контейнер сам не перезапускает.
- config-fingerprint до/после: значения не изменились — 0 отличий на
  rydiwo/atoridu/wsl, на sapphira/otreca только новый юнит и unitConfig.
- epral: убран nginx-mainline из strictModule (nix-on-droid не вычислялся
  с 5712abb); в AGENTS.md исправлен вывод (build.activationPackage) и
  добавлен --impure — T64 (проверить сборку на устройстве).
- .agent: закрыты T10/T49/T50/T54, добавлены T63 (done) и T64 (pending),
  ADR-0012; phases в manifest.json синхронизированы с checkpoints.json.
This commit is contained in:
oqyude committed 2026-11-26 20:16:09 +03:00
1 parent d2692b752b
commit ae760f6ab4
28 files changed
+538 -133

No files matched your search

+1 -1
View File
@@ -56,7 +56,7 @@ in
'';
cookieDomain = lib.mkOption {
type = lib.types.str;
default = "zeroq.su";
default = xlib.net.domains.public;
description = ''
Domain scope for Authelia session cookies and the login-UI vhost
(`authelia.<cookieDomain>`). All protected vhosts must be subdomains
+44 -39
View File
@@ -10,56 +10,61 @@
# 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.
let
# Zone names and records come from the fleet registry (lib/xlib/net.nix).
fqdn = name: "${name}.${xlib.net.domains.public}";
lan = name: "${name}.${xlib.net.domains.internal}";
in
{
services.coredns = {
enable = true;
config = ''
zeroq.su:53 {
${xlib.net.domains.public}:53 {
hosts {
${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
${xlib.net.hosts.otreca.public} ${fqdn "x"}
${xlib.net.hosts.sapphira.lan} ${fqdn "authelia"}
${xlib.net.hosts.sapphira.lan} ${fqdn "calibre"}
${xlib.net.hosts.sapphira.lan} ${fqdn "dns"}
${xlib.net.hosts.sapphira.lan} ${fqdn "flux"}
${xlib.net.hosts.sapphira.lan} ${fqdn "git"}
${xlib.net.hosts.sapphira.lan} ${fqdn "glances"}
${xlib.net.hosts.sapphira.lan} ${fqdn "herdr"}
${xlib.net.hosts.sapphira.lan} ${fqdn "homebox"}
${xlib.net.hosts.sapphira.lan} ${fqdn "immich"}
${xlib.net.hosts.sapphira.lan} ${fqdn "kuma"}
${xlib.net.hosts.sapphira.lan} ${fqdn "navidrome"}
${xlib.net.hosts.sapphira.lan} ${fqdn "nextcloud"}
${xlib.net.hosts.sapphira.lan} ${fqdn "open"}
${xlib.net.hosts.sapphira.lan} ${fqdn "office"}
${xlib.net.hosts.sapphira.lan} ${fqdn "pdf"}
${xlib.net.hosts.sapphira.lan} ${fqdn "syncthing"}
${xlib.net.hosts.sapphira.lan} ${fqdn "talk"}
${xlib.net.hosts.sapphira.lan} ${fqdn "turn"}
${xlib.net.hosts.sapphira.lan} ${fqdn "vtimeline"}
fallthrough
}
cache 300
log
}
home.arpa:53 {
${xlib.net.domains.internal}:53 {
hosts {
${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
${xlib.net.hosts.vetymae.lan} ${lan "vetymae"}
${xlib.net.hosts.sapphira.lan} ${lan "ca"}
${xlib.net.hosts.sapphira.lan} ${lan "calibre"}
${xlib.net.hosts.sapphira.lan} ${lan "dns"}
${xlib.net.hosts.sapphira.lan} ${lan "flux"}
${xlib.net.hosts.sapphira.lan} ${lan "git"}
${xlib.net.hosts.sapphira.lan} ${lan "glances"}
${xlib.net.hosts.sapphira.lan} ${xlib.net.domains.internal}
${xlib.net.hosts.sapphira.lan} ${lan "homebox"}
${xlib.net.hosts.sapphira.lan} ${lan "immich"}
${xlib.net.hosts.sapphira.lan} ${lan "kuma"}
${xlib.net.hosts.sapphira.lan} ${lan "navidrome"}
${xlib.net.hosts.sapphira.lan} ${lan "nextcloud"}
${xlib.net.hosts.sapphira.lan} ${lan "office"}
${xlib.net.hosts.sapphira.lan} ${lan "pdf"}
${xlib.net.hosts.sapphira.lan} ${lan "sapphira"}
${xlib.net.hosts.sapphira.lan} ${lan "syncthing"}
fallthrough
}
cache 300
+3 -3
View File
@@ -67,13 +67,13 @@
# there are other vhosts on the same port). Cert is still mounted in
# case 3x-ui is later reconfigured to terminate TLS itself (e.g. for
# direct node-API access); nginx doesn't have to use it.
host."3x-ui".certDomain = "x.zeroq.su";
host."3x-ui".certDomain = "x.${xlib.net.domains.public}";
# Authelia SSO — currently protects vtimeline.zeroq.su (replaces the
# previous nginx auth_basic htpasswd). Cookie domain is .zeroq.su so a
# single Authelia session covers every protected vhost under the zone.
host.authelia = {
enable = true;
cookieDomain = "zeroq.su";
cookieDomain = xlib.net.domains.public;
};
# ──────────────────────────────────────────────────────────────────────
@@ -141,7 +141,7 @@
Type = "oneshot";
ExecStart = lib.getExe config.modules."3x-ui".reconfigRunner;
Environment = [
"PANEL_URL=https://x.zeroq.su"
"PANEL_URL=https://x.${xlib.net.domains.public}"
];
};
};
+4 -3
View File
@@ -29,6 +29,7 @@
# • Authelia wildcard уже покрывает — менять ничего не надо
let
cfg = config.host.engipy-frontend;
fqdn = name: "${name}.${xlib.net.domains.public}";
in
{
options.host.engipy-frontend = {
@@ -39,7 +40,7 @@ in
domain = lib.mkOption {
type = lib.types.str;
default = "engipy.zeroq.su";
default = fqdn "engipy";
description = "Домен для vhost.";
};
@@ -93,7 +94,7 @@ in
extraConfig = ''
auth_request /authelia;
auth_request_set $authelia_user $upstream_http_remote_user;
error_page 401 =302 https://authelia.zeroq.su/?rd=$scheme://$host$request_uri;
error_page 401 =302 https://${fqdn "authelia"}/?rd=$scheme://$host$request_uri;
client_max_body_size 50m;
proxy_read_timeout 120s;
proxy_send_timeout 120s;
@@ -109,7 +110,7 @@ in
extraConfig = ''
auth_request /authelia;
auth_request_set $authelia_user $upstream_http_remote_user;
error_page 401 =302 https://authelia.zeroq.su/?rd=$scheme://$host$request_uri;
error_page 401 =302 https://${fqdn "authelia"}/?rd=$scheme://$host$request_uri;
'';
};
# Forward-auth endpoint для /authelia sub-request.
+2 -1
View File
@@ -13,6 +13,7 @@ let
# escaped form is spelled out literally: a literal backslash before x2d.
# The `assertions` entry below fails the build if this ever drifts.
unitKey = "gitea-runner-ci\\x2dsapphira";
fqdn = name: "${name}.${xlib.net.domains.public}";
in
{
# ----- Static user for the runner ----------------------------------------
@@ -51,7 +52,7 @@ in
services.gitea-actions-runner.instances."${name}" = {
enable = true;
name = name;
url = "https://git.zeroq.su/"; # matches modules/server/gitea.nix ROOT_URL
url = "https://${fqdn "git"}/"; # matches modules/server/gitea.nix ROOT_URL
tokenFile = config.sops.secrets.gitea-runner-registration.path;
labels = [ "native:host" ]; # only host-executor; no docker required
+1 -1
View File
@@ -17,7 +17,7 @@
# nixpkgs-unstable removed `DOMAIN` — must use the full public URL
# in `ROOT_URL` instead. External entry is HTTPS via nginx with
# ACME (modules/server/nginx.nix:53), so scheme is https, no port.
ROOT_URL = "https://git.zeroq.su/";
ROOT_URL = "https://git.${xlib.net.domains.public}/";
HTTP_PORT = 3000;
};
service.DISABLE_REGISTRATION = true;
+11 -9
View File
@@ -12,13 +12,15 @@ let
config.allowUnfree = true;
config.allowUnfreePredicate = true;
};
fqdn = name: "${name}.${xlib.net.domains.public}";
lan = name: "${name}.${xlib.net.domains.internal}";
in
{
services = {
nextcloud-whiteboard-server = {
enable = true;
settings = {
NEXTCLOUD_URL = "https://nextcloud.zeroq.su";
NEXTCLOUD_URL = "https://${fqdn "nextcloud"}";
};
secrets = [ config.sops.secrets.nextcloud-whiteboard-jwt.path ];
};
@@ -27,7 +29,7 @@ in
hostName = "talk.private";
backends.nextcloud = {
urls = [
"https://nextcloud.zeroq.su"
"https://${fqdn "nextcloud"}"
# "https://nextcloud.home.arpa"
];
secretFile = config.sops.secrets.nextcloud-talk-secret.path;
@@ -47,8 +49,8 @@ in
secretFile = config.sops.secrets.turn-secret.path;
apikeyFile = config.sops.secrets.turn-api-key.path;
servers = [
"turn:turn.zeroq.su:3478?transport=udp"
"turn:turn.zeroq.su:3478?transport=tcp"
"turn:${fqdn "turn"}:3478?transport=udp"
"turn:${fqdn "turn"}:3478?transport=tcp"
# "turns:turn.zeroq.su:5349?transport=tcp"
];
};
@@ -82,11 +84,11 @@ in
xlib.net.hosts.sapphira.lan
xlib.net.hosts.router.public
"localhost"
"nextcloud.home.arpa"
(lan "nextcloud")
"nextcloud.private"
"nextcloud.zeroq.su"
"office.home.arpa"
"office.zeroq.su"
(fqdn "nextcloud")
(lan "office")
(fqdn "office")
];
trusted_proxies = [
xlib.net.hosts.otreca.tailscale
@@ -101,7 +103,7 @@ in
notify_push = {
enable = true;
bendDomainToLocalhost = true;
nextcloudUrl = "https://nextcloud.zeroq.su";
nextcloudUrl = "https://${fqdn "nextcloud"}";
};
# phpPackage = pkgs.php85;
extraApps = {
+32 -27
View File
@@ -14,6 +14,11 @@ let
# server, from the fleet registry (lib/xlib/net.nix).
server = xlib.net.hosts.sapphira.lan;
# DNS names come from the fleet registry (lib/xlib/net.nix): a move to
# another registrable domain changes `domains.public` there, not this file.
fqdn = name: "${name}.${xlib.net.domains.public}";
opencodes = name: "${name}.${xlib.net.domains.opencodes}";
mkProxy =
{
domain,
@@ -39,7 +44,7 @@ let
sites = [
{
domain = "immich.zeroq.su";
domain = fqdn "immich";
port = 2283;
addSSL = true;
extraConfig = bigUploads;
@@ -60,19 +65,19 @@ let
# port = 19999;
# }
{
domain = "git.zeroq.su";
domain = fqdn "git";
port = 3000;
}
{
domain = "homebox.zeroq.su";
domain = fqdn "homebox";
port = 7745;
}
{
domain = "flux.zeroq.su";
domain = fqdn "flux";
port = 6061;
}
{
domain = "tape-rotation.zeroq.su";
domain = fqdn "tape-rotation";
port = 5174;
}
# NOTE: open.zeroq.su is intentionally NOT in this `sites` list —
@@ -82,22 +87,22 @@ let
# to `virtualHosts` below, alongside x.zeroq.su (3x-ui panel,
# same loopback-only pattern).
{
domain = "navidrome.zeroq.su";
domain = fqdn "navidrome";
port = 4533;
addSSL = true;
}
{
domain = "calibre.zeroq.su";
domain = fqdn "calibre";
port = 8083;
extraConfig = bigUploads;
}
{
domain = "nix-cache.zeroq.su";
domain = fqdn "nix-cache";
port = 5000;
extraConfig = bigUploads;
}
{
domain = "pdf.zeroq.su";
domain = fqdn "pdf";
port = 8446;
extraConfig = bigUploads;
}
@@ -131,7 +136,7 @@ in
}
];
};
"office.zeroq.su" = {
"${fqdn "office"}" = {
forceSSL = true;
enableACME = true;
};
@@ -146,7 +151,7 @@ in
# client_max_body_size 6m matches the server.js body limit
# (5 MB hard cap). nginx's default 1m would 413 any upload near
# the cap before the request reached the node process.
"vtimeline.zeroq.su" = {
"${fqdn "vtimeline"}" = {
forceSSL = true;
enableACME = true;
locations = {
@@ -172,7 +177,7 @@ in
# login. Pass the full origin (scheme + host + path) so
# Authelia constructs an absolute redirect back to the
# original vhost.
error_page 401 =302 https://authelia.zeroq.su/?rd=$scheme://$host$request_uri;
error_page 401 =302 https://${fqdn "authelia"}/?rd=$scheme://$host$request_uri;
client_max_body_size 6m;
'';
};
@@ -218,7 +223,7 @@ in
# vtimeline.zeroq.su above — the wildcard rule `*.zeroq.su` in
# modules/server/authelia.nix already covers this subdomain under
# `one_factor`, so no policy change is needed.
"tty.zeroq.su" = {
"${fqdn "tty"}" = {
forceSSL = true;
enableACME = true;
locations = {
@@ -235,7 +240,7 @@ in
# `$scheme://$host$request_uri` so the post-login `rd`
# lands the user back on tty.zeroq.su, not on
# authelia.zeroq.su/<path>.
error_page 401 =302 https://authelia.zeroq.su/?rd=$scheme://$host$request_uri;
error_page 401 =302 https://${fqdn "authelia"}/?rd=$scheme://$host$request_uri;
'';
};
"= /authelia" = {
@@ -291,7 +296,7 @@ in
#
# proxyWebsockets обязателен: терминал стримится по WS
# (/ws/session/<name>), без апгрейда вкладка не получит ни байта.
"vetymae.webmux.zeroq.su" = {
"${fqdn "vetymae.webmux"}" = {
forceSSL = true;
enableACME = true;
locations = {
@@ -306,7 +311,7 @@ in
# запросе отдаёт 302 + Location → nginx показал бы 500 «auth
# request unexpected status». Редирект ведёт на логин с
# абсолютным rd, чтобы после входа вернуться именно сюда.
error_page 401 =302 https://authelia.zeroq.su/?rd=$scheme://$host$request_uri;
error_page 401 =302 https://${fqdn "authelia"}/?rd=$scheme://$host$request_uri;
# Долгоживущие WS-соединения терминала: дефолтные 60 с
# read/send-timeout рвут простаивающую вкладку.
proxy_read_timeout 3600s;
@@ -379,7 +384,7 @@ in
# patch that reads X-Forwarded-Host (fork + plugin link) — the
# same-origin check assumes direct loopback or Tailscale serve,
# both of which give request.url a host that matches the browser.
"herdr.zeroq.su" = {
"${fqdn "herdr"}" = {
forceSSL = true;
enableACME = true;
locations = {
@@ -433,7 +438,7 @@ in
# Authelia has a stable absolute URL to redirect users to. Authelia
# generates internal links against $session.cookies[0].authelia_url,
# which is set to https://${autheliaFqdn}/ in modules/server/authelia.nix.
"authelia.zeroq.su" = {
"${fqdn "authelia"}" = {
forceSSL = true;
enableACME = true;
locations."/" = {
@@ -464,7 +469,7 @@ in
];
extraConfig = bigUploads;
};
"x.zeroq.su" = {
"${fqdn "x"}" = {
forceSSL = true;
enableACME = true;
locations = {
@@ -508,7 +513,7 @@ in
# proxy_read_timeout 300s;
# '';
# };
"zeroq.su" = {
"${xlib.net.domains.public}" = {
forceSSL = true;
enableACME = true;
root = pkgs.writeTextDir "index.html" ''
@@ -537,7 +542,7 @@ in
# и по 22, и по 4096). Рестарт службы Tailscale не помогает, нужен
# интерактивный `tailscale up` на самом хосте. Вернуться на tailnet
# стоит только после этого.
"vetymae.opencodes.zeroq.su" = {
"${opencodes "vetymae"}" = {
forceSSL = true;
enableACME = true;
locations."/" = {
@@ -545,7 +550,7 @@ in
proxyWebsockets = true;
};
};
"lamet.opencodes.zeroq.su" = {
"${opencodes "lamet"}" = {
forceSSL = true;
enableACME = true;
locations."/" = {
@@ -572,7 +577,7 @@ in
# этой же машины. CORS применяется только к cross-origin запросам;
# веб-UI, отданный через этот же nginx-vhost, идёт same-origin,
# поэтому расхождение имён на работу не влияет.
"etherea.opencodes.zeroq.su" = {
"${opencodes "etherea"}" = {
forceSSL = true;
enableACME = true;
locations."/" = {
@@ -587,7 +592,7 @@ in
# что хост недоступен. Vhost поднимается вместе с etherea, и
# отдаёт 502, пока dejavu не поднимут и не запустят на нём
# opencode на 4096. Это ожидаемо, а не поломка конфига.
"dejavu.opencodes.zeroq.su" = {
"${opencodes "dejavu"}" = {
forceSSL = true;
enableACME = true;
locations."/" = {
@@ -608,7 +613,7 @@ in
#
# DNS: *.opencodes.zeroq.su — wildcard CNAME на home.zeroq.su
# (37.128.246.126), отдельная запись в zone не нужна.
"rydiwo.opencodes.zeroq.su" = {
"${opencodes "rydiwo"}" = {
forceSSL = true;
enableACME = true;
locations."/" = {
@@ -619,7 +624,7 @@ in
# sapphira itself: opencode web runs as a systemd user service
# (programs.opencode.web.enable in home/modules/opencode.nix) on
# 127.0.0.1:4096 with --hostname 0.0.0.0.
"opencode.zeroq.su" = {
"${fqdn "opencode"}" = {
forceSSL = true;
enableACME = true;
locations."/" = {
@@ -627,7 +632,7 @@ in
proxyWebsockets = true;
};
};
"nextcloud.zeroq.su" = {
"${fqdn "nextcloud"}" = {
forceSSL = true;
enableACME = true;
locations = {
+1 -1
View File
@@ -17,7 +17,7 @@
services.onlyoffice = {
enable = true;
# package = previous.onlyoffice-documentserver;
hostname = "office.zeroq.su";
hostname = "office.${xlib.net.domains.public}";
port = 8090;
allowLocalConnections = true;
wopi = true;