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:
Sergei Poljanski 2026-11-16 22:59:59 +04:00
commit be68c5adef
Signed by: asxpi
GPG key ID: 4F8851660FA4121B

View file

@ -0,0 +1,33 @@
# Paper. The world, plugins and server.properties are data in
# /var/lib/minecraft and not managed here; Geyser (a plugin) adds the
# Bedrock port.
{ lib, pkgs, ... }:
{
services.minecraft-server = {
enable = true;
eula = true;
package = pkgs.papermc;
jvmOpts = "-Xmx4G -Xms2G";
};
asxpio.waitForData = [ "minecraft-server" ];
systemd.services.minecraft-server = {
# Stopping saves the world first
serviceConfig.TimeoutStopSec = 120;
# Geyser lists the network interfaces (netlink) for Bedrock's
# signalling; the module allows IP sockets only
serviceConfig.RestrictAddressFamilies = lib.mkForce [
"AF_INET"
"AF_INET6"
"AF_UNIX"
"AF_NETLINK"
];
# Geyser unpacks native libraries that expect a usual Linux around
# them (libcrypto, libstdc++)
environment.LD_LIBRARY_PATH = lib.makeLibraryPath [
pkgs.openssl
pkgs.stdenv.cc.cc.lib
];
};
networking.firewall.allowedTCPPorts = [ 25565 ];
networking.firewall.allowedUDPPorts = [ 19132 ];
}