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:
1 parent
53df473609
commit
0ab45578d1
11 files changed
+225
-80
No files matched your search
@@ -154,9 +154,9 @@
|
|||||||
# (см. configurations/mini-laptop.nix).
|
# (см. configurations/mini-laptop.nix).
|
||||||
host.engipy-frontend = {
|
host.engipy-frontend = {
|
||||||
enable = true;
|
enable = true;
|
||||||
# По умолчанию backendHost = "192.168.1.102" (rydiwo LAN IP).
|
# По умолчанию — LAN-адрес rydiwo из реестра флота (lib/xlib/net.nix).
|
||||||
# Если rydiwo переедет на другой адрес — переопределить здесь.
|
# Если rydiwo переедет на другой адрес — менять нужно там, а не здесь.
|
||||||
backendHost = "192.168.1.102";
|
backendHost = xlib.net.hosts.rydiwo.lan;
|
||||||
};
|
};
|
||||||
|
|
||||||
system = {
|
system = {
|
||||||
|
|||||||
@@ -55,8 +55,8 @@
|
|||||||
networking.firewall.interfaces.tailscale0.allowedTCPPorts = [ 22 ];
|
networking.firewall.interfaces.tailscale0.allowedTCPPorts = [ 22 ];
|
||||||
networking = {
|
networking = {
|
||||||
nameservers = [
|
nameservers = [
|
||||||
"1.1.1.1"
|
xlib.net.dns.cloudflare
|
||||||
"8.8.8.8"
|
xlib.net.dns.google
|
||||||
];
|
];
|
||||||
networkmanager.enable = true;
|
networkmanager.enable = true;
|
||||||
tempAddresses = "disabled";
|
tempAddresses = "disabled";
|
||||||
|
|||||||
+7
-7
@@ -249,31 +249,31 @@
|
|||||||
ControlPersist = "no";
|
ControlPersist = "no";
|
||||||
};
|
};
|
||||||
sapphira = {
|
sapphira = {
|
||||||
HostName = "192.168.1.20";
|
HostName = xlib.net.hosts.sapphira.lan;
|
||||||
User = xlib.device.username;
|
User = xlib.device.username;
|
||||||
};
|
};
|
||||||
sapphira-tailscale = {
|
sapphira-tailscale = {
|
||||||
HostName = "100.64.0.0";
|
HostName = xlib.net.hosts.sapphira.tailscale;
|
||||||
User = xlib.device.username;
|
User = xlib.device.username;
|
||||||
};
|
};
|
||||||
otreca-old = {
|
otreca-old = {
|
||||||
HostName = "217.60.3.12";
|
HostName = xlib.net.hosts.otreca.publicOld;
|
||||||
User = xlib.device.username;
|
User = xlib.device.username;
|
||||||
};
|
};
|
||||||
otreca = {
|
otreca = {
|
||||||
HostName = "109.248.161.5";
|
HostName = xlib.net.hosts.otreca.public;
|
||||||
User = xlib.device.username;
|
User = xlib.device.username;
|
||||||
};
|
};
|
||||||
otreca-tailscale = {
|
otreca-tailscale = {
|
||||||
HostName = "100.64.1.0";
|
HostName = xlib.net.hosts.otreca.tailscale;
|
||||||
User = xlib.device.username;
|
User = xlib.device.username;
|
||||||
};
|
};
|
||||||
rydiwo = {
|
rydiwo = {
|
||||||
HostName = "192.168.1.102";
|
HostName = xlib.net.hosts.rydiwo.lan;
|
||||||
User = xlib.device.username;
|
User = xlib.device.username;
|
||||||
};
|
};
|
||||||
epral = {
|
epral = {
|
||||||
HostName = "192.168.1.101";
|
HostName = xlib.net.hosts.epral.lan;
|
||||||
User = xlib.device.username;
|
User = xlib.device.username;
|
||||||
Port = 8022;
|
Port = 8022;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
# device.nix identity + capability flags from the device type
|
# device.nix identity + capability flags from the device type
|
||||||
# dirs.nix well-known paths, derived from username
|
# dirs.nix well-known paths, derived from username
|
||||||
# helpers.nix pure helper functions shared by modules
|
# helpers.nix pure helper functions shared by modules
|
||||||
|
# net.nix registry of fleet addresses and shared ports
|
||||||
#
|
#
|
||||||
# `mkXlib` is called in flake-level code (configurations/default.nix) and
|
# `mkXlib` is called in flake-level code (configurations/default.nix) and
|
||||||
# handed to every module as the `xlib` argument via lib/mkSystem.nix, so
|
# handed to every module as the `xlib` argument via lib/mkSystem.nix, so
|
||||||
@@ -24,6 +25,10 @@ let
|
|||||||
mkDirs = import ./dirs.nix;
|
mkDirs = import ./dirs.nix;
|
||||||
|
|
||||||
helpers = (import ./helpers.nix { inherit lib; });
|
helpers = (import ./helpers.nix { inherit lib; });
|
||||||
|
|
||||||
|
# Fleet topology: addresses and shared ports. The same for every host —
|
||||||
|
# the fleet is the fleet.
|
||||||
|
net = import ./net.nix;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
inherit
|
inherit
|
||||||
@@ -31,6 +36,7 @@ in
|
|||||||
helpers
|
helpers
|
||||||
mkDevice
|
mkDevice
|
||||||
mkDirs
|
mkDirs
|
||||||
|
net
|
||||||
;
|
;
|
||||||
|
|
||||||
# Full host record: identity + capability flags + well-known paths +
|
# Full host record: identity + capability flags + well-known paths +
|
||||||
@@ -67,6 +73,8 @@ in
|
|||||||
isDesktop = device.isDesktop;
|
isDesktop = device.isDesktop;
|
||||||
isHeadless = device.isHeadless;
|
isHeadless = device.isHeadless;
|
||||||
dirs = mkDirs username;
|
dirs = mkDirs username;
|
||||||
|
# Fleet addresses and shared ports — see lib/xlib/net.nix.
|
||||||
|
inherit net;
|
||||||
# Bind the host's ids into the mount helpers, so ntfs3/exfat options
|
# Bind the host's ids into the mount helpers, so ntfs3/exfat options
|
||||||
# carry the same uid/gid the primary user actually has.
|
# carry the same uid/gid the primary user actually has.
|
||||||
helpers = import ./helpers.nix {
|
helpers = import ./helpers.nix {
|
||||||
|
|||||||
@@ -0,0 +1,127 @@
|
|||||||
|
# Registry of the addresses and ports the fleet talks to.
|
||||||
|
#
|
||||||
|
# Why this file exists: the same literal was written in dozens of places
|
||||||
|
# (192.168.1.20 alone — 41 occurrences) across modules that had to agree on
|
||||||
|
# it without knowing about each other. A DHCP lease moves, a Tailscale address
|
||||||
|
# changes, and the copy nobody noticed keeps pointing at the old address. The
|
||||||
|
# repo already documents that failure mode for the 3x-ui chain (ADR-0003);
|
||||||
|
# this file is the same idea applied to plain addresses.
|
||||||
|
#
|
||||||
|
# How to use it: `xlib.net.hosts.sapphira.lan`. The registry is pure data and
|
||||||
|
# is injected into every module as `xlib.net` (see lib/xlib/default.nix), so
|
||||||
|
# it is available both in NixOS modules and in home-manager modules.
|
||||||
|
#
|
||||||
|
# Rules for this file:
|
||||||
|
# * one address — one name. If a literal appears in two modules, both read
|
||||||
|
# it from here.
|
||||||
|
# * Loopback (127.0.0.1) and the wildcard (0.0.0.0) are NOT registered:
|
||||||
|
# they are language-level constants, not fleet topology, and reading
|
||||||
|
# `xlib.net.loopback` would be noise.
|
||||||
|
# * A value owned completely by one module (a service's own port) stays in
|
||||||
|
# that module. `ports` below holds only the ports that are a contract
|
||||||
|
# between two or more modules.
|
||||||
|
# * Modules listed under "not migrated" at the bottom keep their literals
|
||||||
|
# on purpose — see the note there before touching them.
|
||||||
|
{
|
||||||
|
hosts = {
|
||||||
|
# The home server: runs the services, terminates nginx.
|
||||||
|
sapphira = {
|
||||||
|
lan = "192.168.1.20";
|
||||||
|
# Tailscale address, assigned manually (AGENTS.md invariant 4).
|
||||||
|
tailscale = "100.64.0.0";
|
||||||
|
};
|
||||||
|
|
||||||
|
# Chuwi MiniBook — desktop (secondary).
|
||||||
|
rydiwo = {
|
||||||
|
# DHCP lease. It already moved to another machine once (LAMET), which is
|
||||||
|
# exactly why the tailscale address below is the one used for upstream.
|
||||||
|
lan = "192.168.1.102";
|
||||||
|
tailscale = "100.92.238.19";
|
||||||
|
};
|
||||||
|
|
||||||
|
# Windows workstation — the opencode reference machine. Not described in
|
||||||
|
# Nix; only its address is known here.
|
||||||
|
vetymae = {
|
||||||
|
lan = "192.168.1.100";
|
||||||
|
};
|
||||||
|
|
||||||
|
# Other tailnet members publishing an opencode server.
|
||||||
|
lamet = {
|
||||||
|
tailscale = "100.106.21.39";
|
||||||
|
};
|
||||||
|
etherea = {
|
||||||
|
tailscale = "100.125.228.63";
|
||||||
|
};
|
||||||
|
dejavu = {
|
||||||
|
tailscale = "100.86.134.111";
|
||||||
|
};
|
||||||
|
|
||||||
|
# Android device (nix-on-droid), reachable over the LAN on port 8022.
|
||||||
|
epral = {
|
||||||
|
lan = "192.168.1.101";
|
||||||
|
};
|
||||||
|
|
||||||
|
# VPS.
|
||||||
|
otreca = {
|
||||||
|
public = "109.248.161.5";
|
||||||
|
# Previous public address — kept for the `otrea-old` ssh alias.
|
||||||
|
publicOld = "217.60.3.12";
|
||||||
|
tailscale = "100.64.1.0";
|
||||||
|
};
|
||||||
|
|
||||||
|
# Home router: the LAN gateway and the public address behind
|
||||||
|
# home.zeroq.su (the wildcard CNAME target for *.opencodes.zeroq.su).
|
||||||
|
router = {
|
||||||
|
lan = "192.168.1.1";
|
||||||
|
public = "37.128.246.126";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# Public resolvers.
|
||||||
|
dns = {
|
||||||
|
cloudflare = "1.1.1.1";
|
||||||
|
google = "8.8.8.8";
|
||||||
|
};
|
||||||
|
|
||||||
|
# Networks, in CIDR form.
|
||||||
|
networks = {
|
||||||
|
lan = "192.168.1.0/24";
|
||||||
|
tailscale = "100.64.0.0/10";
|
||||||
|
# Podman's default network and the network tape-rotation creates.
|
||||||
|
podman = "10.88.0.0/16";
|
||||||
|
podmanTapeRotation = "10.89.0.0/24";
|
||||||
|
};
|
||||||
|
|
||||||
|
# Static addresses of containers inside the podman networks above. They are
|
||||||
|
# not fleet machines — they only exist inside their own network.
|
||||||
|
containerHosts = {
|
||||||
|
# tape-rotation backend: the frontend reaches it by this address because
|
||||||
|
# the network has no DNS plugin (--add-host).
|
||||||
|
tapeRotationBackend = "10.89.0.10";
|
||||||
|
};
|
||||||
|
|
||||||
|
# Ports that are a contract between two or more modules.
|
||||||
|
ports = {
|
||||||
|
# opencode server: the systemd user service on sapphira, the nginx vhost
|
||||||
|
# `opencode.zeroq.su`, and the `oc` wrapper on every host.
|
||||||
|
opencode = 4096;
|
||||||
|
# Authelia forward-auth endpoint — nginx asks it about every protected
|
||||||
|
# vhost.
|
||||||
|
authelia = 9091;
|
||||||
|
# Host-side port that publishes the 3x-ui container's REALITY inbound
|
||||||
|
# (nginx stream forwards 443 -> 15380 -> container:443).
|
||||||
|
reality3xui = 15380;
|
||||||
|
# Egress proxy published by the 3x-ui container on the host loopback.
|
||||||
|
httpProxy = 10808;
|
||||||
|
};
|
||||||
|
|
||||||
|
# Not migrated, on purpose:
|
||||||
|
# * home/modules/opencode.nix (sapphira) — the working opencode setup of
|
||||||
|
# the owner; AGENTS.md / ADR-0009 forbid refactoring it. Its proxy
|
||||||
|
# environment keeps literal addresses.
|
||||||
|
# * modules/pxe-infra/* — the PXE network has its own option surface
|
||||||
|
# (modules/pxe-infra/options.nix); a second registry for the same
|
||||||
|
# addresses would be a worse problem than the literals it replaces.
|
||||||
|
# * The podman networks of the other containers — assigned by podman
|
||||||
|
# itself; only the two networks above are referenced from two modules.
|
||||||
|
}
|
||||||
@@ -70,7 +70,7 @@ in
|
|||||||
"--network=taperotation_default"
|
"--network=taperotation_default"
|
||||||
# Static IP the frontend reaches "backend" at (see --add-host
|
# Static IP the frontend reaches "backend" at (see --add-host
|
||||||
# in the frontend container; network DNS is disabled).
|
# in the frontend container; network DNS is disabled).
|
||||||
"--ip=10.89.0.10"
|
"--ip=${xlib.net.containerHosts.tapeRotationBackend}"
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
"taperotation-frontend" = {
|
"taperotation-frontend" = {
|
||||||
@@ -83,7 +83,7 @@ in
|
|||||||
"--network=taperotation_default"
|
"--network=taperotation_default"
|
||||||
# Baked-in nginx upstream is http://backend:8001; resolve it via
|
# Baked-in nginx upstream is http://backend:8001; resolve it via
|
||||||
# /etc/hosts since the network has no DNS plugin.
|
# /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
|
# backend's static IP. Recreate-on-start also self-heals after a
|
||||||
# `podman system prune` removed the (temporarily unused) network.
|
# `podman system prune` removed the (temporarily unused) network.
|
||||||
podman network rm -f taperotation_default >/dev/null 2>&1 || true
|
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" ];
|
partOf = [ "podman-compose-tape-rotation-root.target" ];
|
||||||
wantedBy = [ "podman-compose-tape-rotation-root.target" ];
|
wantedBy = [ "podman-compose-tape-rotation-root.target" ];
|
||||||
|
|||||||
+45
-38
@@ -1,34 +1,41 @@
|
|||||||
{
|
{
|
||||||
config,
|
config,
|
||||||
pkgs,
|
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 = {
|
services.coredns = {
|
||||||
enable = true;
|
enable = true;
|
||||||
config = ''
|
config = ''
|
||||||
zeroq.su:53 {
|
zeroq.su:53 {
|
||||||
hosts {
|
hosts {
|
||||||
109.248.161.5 x.zeroq.su
|
${xlib.net.hosts.otreca.public} x.zeroq.su
|
||||||
192.168.1.20 authelia.zeroq.su
|
${xlib.net.hosts.sapphira.lan} authelia.zeroq.su
|
||||||
192.168.1.20 calibre.zeroq.su
|
${xlib.net.hosts.sapphira.lan} calibre.zeroq.su
|
||||||
192.168.1.20 dns.zeroq.su
|
${xlib.net.hosts.sapphira.lan} dns.zeroq.su
|
||||||
192.168.1.20 flux.zeroq.su
|
${xlib.net.hosts.sapphira.lan} flux.zeroq.su
|
||||||
192.168.1.20 git.zeroq.su
|
${xlib.net.hosts.sapphira.lan} git.zeroq.su
|
||||||
192.168.1.20 glances.zeroq.su
|
${xlib.net.hosts.sapphira.lan} glances.zeroq.su
|
||||||
192.168.1.20 herdr.zeroq.su
|
${xlib.net.hosts.sapphira.lan} herdr.zeroq.su
|
||||||
192.168.1.20 homebox.zeroq.su
|
${xlib.net.hosts.sapphira.lan} homebox.zeroq.su
|
||||||
192.168.1.20 immich.zeroq.su
|
${xlib.net.hosts.sapphira.lan} immich.zeroq.su
|
||||||
192.168.1.20 kuma.zeroq.su
|
${xlib.net.hosts.sapphira.lan} kuma.zeroq.su
|
||||||
192.168.1.20 navidrome.zeroq.su
|
${xlib.net.hosts.sapphira.lan} navidrome.zeroq.su
|
||||||
192.168.1.20 nextcloud.zeroq.su
|
${xlib.net.hosts.sapphira.lan} nextcloud.zeroq.su
|
||||||
192.168.1.20 open.zeroq.su
|
${xlib.net.hosts.sapphira.lan} open.zeroq.su
|
||||||
192.168.1.20 office.zeroq.su
|
${xlib.net.hosts.sapphira.lan} office.zeroq.su
|
||||||
192.168.1.20 pdf.zeroq.su
|
${xlib.net.hosts.sapphira.lan} pdf.zeroq.su
|
||||||
192.168.1.20 syncthing.zeroq.su
|
${xlib.net.hosts.sapphira.lan} syncthing.zeroq.su
|
||||||
192.168.1.20 talk.zeroq.su
|
${xlib.net.hosts.sapphira.lan} talk.zeroq.su
|
||||||
192.168.1.20 turn.zeroq.su
|
${xlib.net.hosts.sapphira.lan} turn.zeroq.su
|
||||||
192.168.1.20 vtimeline.zeroq.su
|
${xlib.net.hosts.sapphira.lan} vtimeline.zeroq.su
|
||||||
fallthrough
|
fallthrough
|
||||||
}
|
}
|
||||||
cache 300
|
cache 300
|
||||||
@@ -36,30 +43,30 @@
|
|||||||
}
|
}
|
||||||
home.arpa:53 {
|
home.arpa:53 {
|
||||||
hosts {
|
hosts {
|
||||||
192.168.1.100 vetymae.home.arpa
|
${xlib.net.hosts.vetymae.lan} vetymae.home.arpa
|
||||||
192.168.1.20 ca.home.arpa
|
${xlib.net.hosts.sapphira.lan} ca.home.arpa
|
||||||
192.168.1.20 calibre.home.arpa
|
${xlib.net.hosts.sapphira.lan} calibre.home.arpa
|
||||||
192.168.1.20 dns.home.arpa
|
${xlib.net.hosts.sapphira.lan} dns.home.arpa
|
||||||
192.168.1.20 flux.home.arpa
|
${xlib.net.hosts.sapphira.lan} flux.home.arpa
|
||||||
192.168.1.20 git.home.arpa
|
${xlib.net.hosts.sapphira.lan} git.home.arpa
|
||||||
192.168.1.20 glances.home.arpa
|
${xlib.net.hosts.sapphira.lan} glances.home.arpa
|
||||||
192.168.1.20 home.arpa
|
${xlib.net.hosts.sapphira.lan} home.arpa
|
||||||
192.168.1.20 homebox.home.arpa
|
${xlib.net.hosts.sapphira.lan} homebox.home.arpa
|
||||||
192.168.1.20 immich.home.arpa
|
${xlib.net.hosts.sapphira.lan} immich.home.arpa
|
||||||
192.168.1.20 kuma.home.arpa
|
${xlib.net.hosts.sapphira.lan} kuma.home.arpa
|
||||||
192.168.1.20 navidrome.home.arpa
|
${xlib.net.hosts.sapphira.lan} navidrome.home.arpa
|
||||||
192.168.1.20 nextcloud.home.arpa
|
${xlib.net.hosts.sapphira.lan} nextcloud.home.arpa
|
||||||
192.168.1.20 office.home.arpa
|
${xlib.net.hosts.sapphira.lan} office.home.arpa
|
||||||
192.168.1.20 pdf.home.arpa
|
${xlib.net.hosts.sapphira.lan} pdf.home.arpa
|
||||||
192.168.1.20 sapphira.home.arpa
|
${xlib.net.hosts.sapphira.lan} sapphira.home.arpa
|
||||||
192.168.1.20 syncthing.home.arpa
|
${xlib.net.hosts.sapphira.lan} syncthing.home.arpa
|
||||||
fallthrough
|
fallthrough
|
||||||
}
|
}
|
||||||
cache 300
|
cache 300
|
||||||
log
|
log
|
||||||
}
|
}
|
||||||
.:53 {
|
.:53 {
|
||||||
forward . 192.168.1.1 1.1.1.1
|
forward . ${xlib.net.hosts.router.lan} ${xlib.net.dns.cloudflare}
|
||||||
cache 300
|
cache 300
|
||||||
}
|
}
|
||||||
'';
|
'';
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
config,
|
config,
|
||||||
lib,
|
lib,
|
||||||
|
xlib,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
# engipy — frontend-only nginx vhost для sapphira.
|
# engipy — frontend-only nginx vhost для sapphira.
|
||||||
@@ -54,12 +55,12 @@ in
|
|||||||
|
|
||||||
backendHost = lib.mkOption {
|
backendHost = lib.mkOption {
|
||||||
type = lib.types.str;
|
type = lib.types.str;
|
||||||
default = "192.168.1.102";
|
default = xlib.net.hosts.rydiwo.lan;
|
||||||
example = "rydiwo.lan";
|
example = "rydiwo.lan";
|
||||||
description = ''
|
description = ''
|
||||||
Хост, где крутится uvicorn (engipy-backend). По умолчанию
|
Хост, где крутится uvicorn (engipy-backend). По умолчанию
|
||||||
rydiwo — 192.168.1.102 в LAN. По этому адресу nginx проксирует
|
rydiwo — его LAN-адрес из реестра флота (lib/xlib/net.nix).
|
||||||
/api/* внутри vhost'а.
|
По этому адресу nginx проксирует /api/* внутри vhost'а.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -78,9 +78,9 @@ in
|
|||||||
settings = {
|
settings = {
|
||||||
log_type = "file";
|
log_type = "file";
|
||||||
trusted_domains = [
|
trusted_domains = [
|
||||||
"100.64.0.0"
|
xlib.net.hosts.sapphira.tailscale
|
||||||
"192.168.1.20"
|
xlib.net.hosts.sapphira.lan
|
||||||
"37.128.246.126"
|
xlib.net.hosts.router.public
|
||||||
"localhost"
|
"localhost"
|
||||||
"nextcloud.home.arpa"
|
"nextcloud.home.arpa"
|
||||||
"nextcloud.private"
|
"nextcloud.private"
|
||||||
@@ -89,10 +89,10 @@ in
|
|||||||
"office.zeroq.su"
|
"office.zeroq.su"
|
||||||
];
|
];
|
||||||
trusted_proxies = [
|
trusted_proxies = [
|
||||||
"100.64.1.0"
|
xlib.net.hosts.otreca.tailscale
|
||||||
"109.248.161.5"
|
xlib.net.hosts.otreca.public
|
||||||
"192.168.1.20"
|
xlib.net.hosts.sapphira.lan
|
||||||
"37.128.246.126"
|
xlib.net.hosts.router.public
|
||||||
];
|
];
|
||||||
overwriteprotocol = "https"; # maybe no
|
overwriteprotocol = "https"; # maybe no
|
||||||
};
|
};
|
||||||
|
|||||||
+18
-16
@@ -9,7 +9,9 @@
|
|||||||
# x.zeroq.su is the 3x-ui controller panel — see 3x-ui.nix for the
|
# x.zeroq.su is the 3x-ui controller panel — see 3x-ui.nix for the
|
||||||
# /subs/, /subsjs/, /clash/ routing logic.
|
# /subs/, /subsjs/, /clash/ routing logic.
|
||||||
let
|
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 =
|
mkProxy =
|
||||||
{
|
{
|
||||||
@@ -113,11 +115,11 @@ in
|
|||||||
enableACME = false;
|
enableACME = false;
|
||||||
listen = [
|
listen = [
|
||||||
{
|
{
|
||||||
addr = "100.64.0.0";
|
addr = xlib.net.hosts.sapphira.tailscale;
|
||||||
port = 10000;
|
port = 10000;
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
addr = "192.168.1.20";
|
addr = xlib.net.hosts.sapphira.lan;
|
||||||
port = 10000;
|
port = 10000;
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
@@ -174,7 +176,7 @@ in
|
|||||||
"= /authelia" = {
|
"= /authelia" = {
|
||||||
extraConfig = ''
|
extraConfig = ''
|
||||||
internal;
|
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
|
# Never forward the client request body to the auth
|
||||||
# subrequest. nginx relays the original Content-Length to
|
# subrequest. nginx relays the original Content-Length to
|
||||||
# /authelia but does not relay the body itself, so Authelia
|
# /authelia but does not relay the body itself, so Authelia
|
||||||
@@ -236,7 +238,7 @@ in
|
|||||||
"= /authelia" = {
|
"= /authelia" = {
|
||||||
extraConfig = ''
|
extraConfig = ''
|
||||||
internal;
|
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
|
# Never forward the client request body to the auth
|
||||||
# subrequest. nginx relays the original Content-Length to
|
# subrequest. nginx relays the original Content-Length to
|
||||||
# /authelia but does not relay the body itself, so Authelia
|
# /authelia but does not relay the body itself, so Authelia
|
||||||
@@ -291,7 +293,7 @@ in
|
|||||||
enableACME = true;
|
enableACME = true;
|
||||||
locations = {
|
locations = {
|
||||||
"/" = {
|
"/" = {
|
||||||
proxyPass = "http://192.168.1.100:8083";
|
proxyPass = "http://${xlib.net.hosts.vetymae.lan}:8083";
|
||||||
proxyWebsockets = true;
|
proxyWebsockets = true;
|
||||||
extraConfig = ''
|
extraConfig = ''
|
||||||
auth_request /authelia;
|
auth_request /authelia;
|
||||||
@@ -311,7 +313,7 @@ in
|
|||||||
"= /authelia" = {
|
"= /authelia" = {
|
||||||
extraConfig = ''
|
extraConfig = ''
|
||||||
internal;
|
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 решает по
|
# Тело запроса в subrequest не отправляем: Authelia решает по
|
||||||
# заголовкам, а без этого он ждёт байты, которых не будет, и
|
# заголовкам, а без этого он ждёт байты, которых не будет, и
|
||||||
# отвечает 408 — статус, который auth_request не классифицирует
|
# отвечает 408 — статус, который auth_request не классифицирует
|
||||||
@@ -432,7 +434,7 @@ in
|
|||||||
forceSSL = true;
|
forceSSL = true;
|
||||||
enableACME = true;
|
enableACME = true;
|
||||||
locations."/" = {
|
locations."/" = {
|
||||||
proxyPass = "http://127.0.0.1:9091";
|
proxyPass = "http://127.0.0.1:${toString xlib.net.ports.authelia}";
|
||||||
proxyWebsockets = true;
|
proxyWebsockets = true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@@ -445,11 +447,11 @@ in
|
|||||||
port = 80;
|
port = 80;
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
addr = "100.64.0.0";
|
addr = xlib.net.hosts.sapphira.tailscale;
|
||||||
port = 8446;
|
port = 8446;
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
addr = "192.168.1.20";
|
addr = xlib.net.hosts.sapphira.lan;
|
||||||
port = 8446;
|
port = 8446;
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
@@ -536,7 +538,7 @@ in
|
|||||||
forceSSL = true;
|
forceSSL = true;
|
||||||
enableACME = true;
|
enableACME = true;
|
||||||
locations."/" = {
|
locations."/" = {
|
||||||
proxyPass = "http://192.168.1.100:4096";
|
proxyPass = "http://${xlib.net.hosts.vetymae.lan}:${toString xlib.net.ports.opencode}";
|
||||||
proxyWebsockets = true;
|
proxyWebsockets = true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@@ -544,7 +546,7 @@ in
|
|||||||
forceSSL = true;
|
forceSSL = true;
|
||||||
enableACME = true;
|
enableACME = true;
|
||||||
locations."/" = {
|
locations."/" = {
|
||||||
proxyPass = "http://100.106.21.39:4096";
|
proxyPass = "http://${xlib.net.hosts.lamet.tailscale}:${toString xlib.net.ports.opencode}";
|
||||||
proxyWebsockets = true;
|
proxyWebsockets = true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@@ -571,7 +573,7 @@ in
|
|||||||
forceSSL = true;
|
forceSSL = true;
|
||||||
enableACME = true;
|
enableACME = true;
|
||||||
locations."/" = {
|
locations."/" = {
|
||||||
proxyPass = "http://100.125.228.63:4096";
|
proxyPass = "http://${xlib.net.hosts.etherea.tailscale}:${toString xlib.net.ports.opencode}";
|
||||||
proxyWebsockets = true;
|
proxyWebsockets = true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@@ -586,7 +588,7 @@ in
|
|||||||
forceSSL = true;
|
forceSSL = true;
|
||||||
enableACME = true;
|
enableACME = true;
|
||||||
locations."/" = {
|
locations."/" = {
|
||||||
proxyPass = "http://100.86.134.111:4096";
|
proxyPass = "http://${xlib.net.hosts.dejavu.tailscale}:${toString xlib.net.ports.opencode}";
|
||||||
proxyWebsockets = true;
|
proxyWebsockets = true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@@ -607,7 +609,7 @@ in
|
|||||||
forceSSL = true;
|
forceSSL = true;
|
||||||
enableACME = true;
|
enableACME = true;
|
||||||
locations."/" = {
|
locations."/" = {
|
||||||
proxyPass = "http://100.92.238.19:4096";
|
proxyPass = "http://${xlib.net.hosts.rydiwo.tailscale}:${toString xlib.net.ports.opencode}";
|
||||||
proxyWebsockets = true;
|
proxyWebsockets = true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@@ -618,7 +620,7 @@ in
|
|||||||
forceSSL = true;
|
forceSSL = true;
|
||||||
enableACME = true;
|
enableACME = true;
|
||||||
locations."/" = {
|
locations."/" = {
|
||||||
proxyPass = "http://127.0.0.1:4096";
|
proxyPass = "http://127.0.0.1:${toString xlib.net.ports.opencode}";
|
||||||
proxyWebsockets = true;
|
proxyWebsockets = true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
serviceName = "rsync-services-sync";
|
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}";
|
serverDir = "${xlib.dirs.services-nodes-folder}/${xlib.device.hostname}";
|
||||||
nodeDir = "${xlib.dirs.services-mnt-folder}";
|
nodeDir = "${xlib.dirs.services-mnt-folder}";
|
||||||
in
|
in
|
||||||
|
|||||||
Reference in new issue
Block a user