nixos: describe both servers as NixOS systems
Start of the move from Ansible to NixOS. Services run as native NixOS services where nixpkgs has a module and as Podman containers otherwise; there is no Docker. Shared: users with their Debian UIDs, SSH with the Ansible role's crypto settings, nftables firewall, WireGuard (ops is the hub), sops-nix secrets per host, the restic backup script with its schedule and retention, mail on unit failure. asxpio-services: Xray, SillyTavern, Minecraft (Paper) and the ACME forwarder natively; XMPP stays in containers because the server is a custom build. asxpio-ops: Postgres, Garage and Forgejo natively. Roles, buckets, keys and grants move here from the storage repo's init scripts. Services that own data wait for /var/lib/.data-in-place, so an install never creates empty state where a restore is about to land. migration/*-data.sh move the Debian-era data into the new layout. hosts/rehearsal turns the two hosts into a test pair with its own keys and dummy secrets. Everything here ran there, Postgres, Garage, Forgejo, Minecraft and SillyTavern on a restored copy of production data. Three differences from the containers showed up and are handled: Garage rejects a 0440 credential file, Geyser needs libcrypto and netlink, SillyTavern ignores the module's listen flags. Production is untouched: both servers still run Debian under Ansible. Assisted-by: Claude:fable-5-2
This commit is contained in:
parent
c51522d371
commit
be68c5adef
1 changed files with 1981 additions and 0 deletions
67
nixos/hosts/asxpio-ops/default.nix
Normal file
67
nixos/hosts/asxpio-ops/default.nix
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
# 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 = [
|
||||
./forgejo.nix
|
||||
./garage.nix
|
||||
./postgres.nix
|
||||
];
|
||||
|
||||
networking.hostName = lib.mkDefault "asxpio-ops";
|
||||
networking.domain = "asxp.io";
|
||||
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"
|
||||
];
|
||||
};
|
||||
}
|
||||
Loading…
Reference in a new issue