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
50
nixos/modules/hetzner.nix
Normal file
50
nixos/modules/hetzner.nix
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
# Hetzner Cloud VM as nixos-infect leaves it: the Debian image's disk
|
||||
# (sda1 ext4 root, sda14 BIOS boot, sda15 unused ESP), GRUB in the MBR.
|
||||
{ lib, modulesPath, ... }:
|
||||
{
|
||||
imports = [ (modulesPath + "/profiles/qemu-guest.nix") ];
|
||||
|
||||
boot.loader.grub.device = "/dev/sda";
|
||||
boot.initrd.availableKernelModules = [
|
||||
"ata_piix"
|
||||
"uhci_hcd"
|
||||
"virtio_pci"
|
||||
"virtio_scsi"
|
||||
"sd_mod"
|
||||
];
|
||||
fileSystems."/" = {
|
||||
device = "/dev/sda1";
|
||||
fsType = "ext4";
|
||||
};
|
||||
boot.tmp.cleanOnBoot = true;
|
||||
services.qemuGuest.enable = true;
|
||||
|
||||
# Public interface: IPv4 by DHCP, IPv6 static (asxpio.ipv6, Hetzner
|
||||
# offers no router advertisements). Private network: DHCP, never the
|
||||
# default route. Names differ between a switch from the bootstrap
|
||||
# system (eth0) and a boot of this one (enp1s0).
|
||||
networking.useDHCP = false;
|
||||
networking.useNetworkd = true;
|
||||
systemd.network.enable = true;
|
||||
systemd.network.networks = {
|
||||
"10-public" = {
|
||||
matchConfig.Name = "enp1s0 eth0";
|
||||
networkConfig.DHCP = "ipv4";
|
||||
routes = [ { Gateway = "fe80::1"; } ];
|
||||
};
|
||||
"20-private" = {
|
||||
matchConfig.Name = "enp7s0 ens10";
|
||||
networkConfig.DHCP = "ipv4";
|
||||
dhcpV4Config = {
|
||||
RouteMetric = 2000;
|
||||
UseDNS = false;
|
||||
};
|
||||
linkConfig.RequiredForOnline = "no";
|
||||
};
|
||||
};
|
||||
networking.nameservers = lib.mkDefault [
|
||||
"185.12.64.1"
|
||||
"185.12.64.2"
|
||||
"2a01:4ff:ff00::add:1"
|
||||
];
|
||||
}
|
||||
Loading…
Reference in a new issue