All checks were successful
nixos / nixos (push) Successful in 33s
ops is the WireGuard hub. If WireGuard does not come back after the switch, root may still log in from the admin's exit address (services' IPv4, where the admin's traffic leaves through Xray). Root only, ops only; the dead-man reboot covers the rest. Remove after Phase 2. Assisted-by: Claude:opus-5-5
79 lines
2.4 KiB
Nix
79 lines
2.4 KiB
Nix
# asxpio-ops: Traefik, Forgejo, storage, the app stacks.
|
|
# Services are added here as they move over from ../../ansible (see
|
|
# MIGRATION.md at the repo root); until then this is the base system only.
|
|
{ lib, ... }:
|
|
{
|
|
imports = [
|
|
./apps.nix
|
|
./crawler.nix
|
|
./forgejo.nix
|
|
./garage.nix
|
|
./monitoring
|
|
./options.nix
|
|
./postgres.nix
|
|
./traefik.nix
|
|
./xmpp-cert-sync.nix
|
|
];
|
|
|
|
networking.hostName = lib.mkDefault "asxpio-ops";
|
|
networking.domain = "asxp.io";
|
|
asxpio.privateIPv4 = "10.10.0.10";
|
|
|
|
# Break-glass for the conversion (MIGRATION.md, Phase 2): root from the
|
|
# admin's exit address (services' IPv4, through Xray), in case WireGuard
|
|
# does not come back. REMOVE after Phase 2.
|
|
asxpio.rootSshFromExtra = lib.mkDefault [ "46.62.228.216/32" ];
|
|
system.stateVersion = "26.05";
|
|
|
|
systemd.network.networks."10-public".address = [ "2a01:4f9:c013:3258::1/64" ];
|
|
|
|
sops.defaultSopsFile = lib.mkDefault ../../secrets/asxpio-ops.yaml;
|
|
|
|
# --- WireGuard hub -------------------------------------------------------
|
|
asxpio.wireguard = {
|
|
interface = "wg0";
|
|
address = [
|
|
"10.20.0.10/24"
|
|
"fd69:69:69::1/64"
|
|
];
|
|
listenPort = 60101;
|
|
hub = true;
|
|
peers = lib.mkDefault (
|
|
map
|
|
(p: {
|
|
inherit (p) name publicKey;
|
|
allowedIPs = [
|
|
"10.20.0.${toString p.id}/32"
|
|
"fd69:69:69::${toString p.id}/128"
|
|
];
|
|
})
|
|
[
|
|
{ id = 20; name = "asxpio-services"; publicKey = "I2D4RvGHm0bW2mMlq9lPvbINHvnP9MsZg4XGMKTLiSU="; }
|
|
{ id = 2; name = "laptop"; publicKey = "6xYBPCiAa1MBusj7ilHGvwIoj26cXymvVksrOQLY52g="; }
|
|
{ id = 3; name = "aleks"; publicKey = "Csqd94oo6eRLUrlzeEkFxlW2IZtQG61ASXdK+ZjKzGI="; }
|
|
{ id = 4; name = "zerrtika"; publicKey = "uBRSmDuM25ciVaS9GxlCbjNPMUlmtphPDvtcEFzs8kI="; }
|
|
{ id = 5; name = "sanya"; publicKey = "tegWIorm7PjagnixbzQjCGLqDKVImynLNgk/bfx2PEk="; }
|
|
]
|
|
);
|
|
};
|
|
|
|
swapDevices = [
|
|
{
|
|
device = "/swapfile";
|
|
size = 2048;
|
|
}
|
|
];
|
|
|
|
# --- Backup ---------------------------------------------------------------
|
|
# Each service adds its own paths and hooks next to its definition:
|
|
# Postgres as a dump, Garage with a metadata snapshot, Forgejo's SQLite
|
|
# through the online backup API.
|
|
asxpio.backup = {
|
|
hostName = "asxpio-ops";
|
|
schedule = "*-*-* 03:30:00";
|
|
paths = [
|
|
"/etc/ssh" # the host key decrypts this host's secrets
|
|
"/opt"
|
|
];
|
|
};
|
|
}
|