dr-server: run Dungeon Runners Reborn headless under Wine

New service module on FredOS-Mediaserver that launches the friend's
Windows-only Unity server (DR_Server.exe -batchmode -nographics) in a
Win64 wine prefix. wineboot initializes the prefix on first start.
Opens auth/game/queue ports 2110, 2603-2606 (TCP+UDP).

Build files staged separately at ~/dr-server-build on the server;
sudo-move into /var/lib/dr-server/Build after the rebuild.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
ediblerope 2026-05-07 09:40:42 +01:00
parent 38e2275b0b
commit 8b83cf9bfb
2 changed files with 70 additions and 0 deletions

View file

@ -19,6 +19,7 @@
# Services #
./services/server-permissions.nix
./services/game-servers.nix
./services/dr-server.nix
./services/qbittorrent-nox.nix
./services/nginx.nix
./services/go2rtc.nix

69
services/dr-server.nix Normal file
View file

@ -0,0 +1,69 @@
{ config, pkgs, lib, ... }:
let
wine = pkgs.wineWowPackages.stable;
dataDir = "/var/lib/dr-server";
buildDir = "${dataDir}/Build";
prefix = "${dataDir}/wine";
logDir = "${dataDir}/log";
in
{
config = lib.mkIf (config.networking.hostName == "FredOS-Mediaserver") {
users.users.dr-server = {
isSystemUser = true;
group = "dr-server";
home = dataDir;
description = "Dungeon Runners Reborn server";
};
users.groups.dr-server = {};
systemd.tmpfiles.rules = [
"d ${dataDir} 0750 dr-server dr-server -"
"d ${buildDir} 0750 dr-server dr-server -"
"d ${prefix} 0750 dr-server dr-server -"
"d ${logDir} 0750 dr-server dr-server -"
];
## <----- DUNGEON RUNNERS REBORN ----> ##
# Windows-only Unity build run headless under Wine. Initializes a
# Win64 prefix on first boot via wineboot, then launches the exe
# with Unity's batch flags. Only the friend's exe is in this tree —
# the matching client is needed on connecting machines.
systemd.services.dr-server = {
description = "Dungeon Runners Reborn (Wine, headless Unity)";
after = [ "network-online.target" ];
wants = [ "network-online.target" ];
wantedBy = [ "multi-user.target" ];
path = [ wine pkgs.coreutils ];
environment = {
WINEPREFIX = prefix;
WINEARCH = "win64";
WINEDEBUG = "-all";
HOME = dataDir;
DISPLAY = "";
};
preStart = ''
if [ ! -f "${prefix}/system.reg" ]; then
${wine}/bin/wineboot --init
${wine}/bin/wineserver -w
fi
'';
unitConfig.ConditionPathExists = "${buildDir}/DR_Server.exe";
serviceConfig = {
Type = "simple";
User = "dr-server";
Group = "dr-server";
WorkingDirectory = buildDir;
ExecStart = "${wine}/bin/wine64 DR_Server.exe -batchmode -nographics -logFile ${logDir}/server.log";
Restart = "on-failure";
RestartSec = "10s";
};
};
networking.firewall.allowedTCPPorts = [ 2110 2603 2604 2605 2606 ];
networking.firewall.allowedUDPPorts = [ 2110 2603 2604 2605 2606 ];
};
}