flake: add mediaserver-vm host for testing services from scratch

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
rope 2026-08-03 14:07:34 +01:00
parent 11f73e9e6a
commit 0235bc9875
3 changed files with 57 additions and 4 deletions

1
HEAD Submodule

@ -0,0 +1 @@
Subproject commit 11f73e9e6aa6ac3343750590e00b53a6dd70fe2e

View file

@ -39,7 +39,6 @@
specialArgs = { inherit inputs; };
modules = [
./hosts/${hostname}.nix
./hosts/hardware/${hostname}.nix
./common.nix
home-manager.nixosModules.home-manager
stylix.nixosModules.stylix
@ -49,9 +48,14 @@
in
{
nixosConfigurations = {
FredOS-Gaming = mkHost "FredOS-Gaming" [];
FredOS-Mediaserver = mkHost "FredOS-Mediaserver" [];
FredOS-Macbook = mkHost "FredOS-Macbook" [];
FredOS-Gaming = mkHost "FredOS-Gaming" [ ./hosts/hardware/FredOS-Gaming.nix ];
FredOS-Mediaserver = mkHost "FredOS-Mediaserver" [ ./hosts/hardware/FredOS-Mediaserver.nix ];
FredOS-Macbook = mkHost "FredOS-Macbook" [ ./hosts/hardware/FredOS-Macbook.nix ];
# Mediaserver's services on fake hardware, for testing from-scratch
# bring-up (arr-interconnect especially) in a throwaway VM:
# nixos-rebuild build-vm --flake .#mediaserver-vm
mediaserver-vm = mkHost "FredOS-Mediaserver" [ ./hosts/hardware/vm.nix ];
};
};
}

48
hosts/hardware/vm.nix Normal file
View file

@ -0,0 +1,48 @@
#./hosts/hardware/vm.nix
# Stand-in "hardware" for `nixos-rebuild build-vm --flake .#mediaserver-vm`.
#
# Keeps hostName = FredOS-Mediaserver so every hostname-gated module under
# services/ switches on, but throws away the real disks, NICs and GPU. The
# point is watching arr-interconnect wire a *fresh* stack from empty state —
# something the live host can't demonstrate anymore, since its /var/lib is
# already populated and the script is a reconciler, not an installer.
{ lib, ... }:
{
networking.hostName = "FredOS-Mediaserver";
system.stateVersion = "25.11";
nixpkgs.hostPlatform = "x86_64-linux";
# qemu-vm.nix supplies "/" and the bootloader. Only the media pool has to
# exist by hand, so the *arr root folders resolve — contents are throwaway.
fileSystems."/mnt/storage" = {
device = "tmpfs";
fsType = "tmpfs";
options = [ "mode=0777" ];
};
# --- Undo router.nix. This VM is not a router. ---
# Its networkd units match NIC names pinned to the real MACs, so the VM's
# NIC matches nothing and comes up unconfigured; its nft input chain is
# policy-drop, which would eat the forwarded ports below. Scripted DHCP on
# QEMU's user-mode NIC replaces both.
networking.useNetworkd = lib.mkForce false;
networking.nftables.tables = lib.mkForce { };
services.dnsmasq.enable = lib.mkForce false;
virtualisation.vmVariant.virtualisation = {
memorySize = 8192;
cores = 4;
diskSize = 32768; # docker images for shelfarr/profilarr are not small
graphics = false; # serial console; ctrl-a x to quit
forwardPorts = [
{ from = "host"; host.port = 2222; guest.port = 22; }
{ from = "host"; host.port = 8989; guest.port = 8989; } # sonarr
{ from = "host"; host.port = 7878; guest.port = 7878; } # radarr
{ from = "host"; host.port = 9696; guest.port = 9696; } # prowlarr
{ from = "host"; host.port = 6767; guest.port = 6767; } # bazarr
{ from = "host"; host.port = 8080; guest.port = 8080; } # qbittorrent
{ from = "host"; host.port = 8096; guest.port = 8096; } # jellyfin
{ from = "host"; host.port = 5055; guest.port = 5055; } # seerr
];
};
}