summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config/router.nix8
-rw-r--r--data/dns/db.orbekk.shared.zone1
-rw-r--r--machines/dragon.nix3
-rw-r--r--machines/firelink.nix1
-rw-r--r--modules/valheim.nix47
5 files changed, 60 insertions, 0 deletions
diff --git a/config/router.nix b/config/router.nix
index c91fe71..073dada 100644
--- a/config/router.nix
+++ b/config/router.nix
@@ -62,6 +62,10 @@ in
proto 41 ACCEPT; # IPv6 sit tunnel
interface ($DEV_WAN $DEV_UNTRUSTED_LAN) @subchain "wan_services" {
+ # Valheim
+ proto udp dport 3400 ACCEPT;
+ proto udp dport 3401 ACCEPT;
+
proto (tcp udp) dport (bootpc bootps) ACCEPT;
proto tcp dport ssh ACCEPT;
proto (tcp udp) dport domain ACCEPT;
@@ -70,6 +74,10 @@ in
}
interface $DEV_LAN @subchain "lan_services" {
+ # Valheim
+ proto udp dport 3400 ACCEPT;
+ proto udp dport 3401 ACCEPT;
+
proto (tcp udp) dport (ssh domain bootpc bootps) ACCEPT;
proto tcp dport (http https) ACCEPT;
# prometheus temp rule
diff --git a/data/dns/db.orbekk.shared.zone b/data/dns/db.orbekk.shared.zone
index 9c97771..86507ed 100644
--- a/data/dns/db.orbekk.shared.zone
+++ b/data/dns/db.orbekk.shared.zone
@@ -22,6 +22,7 @@ _acme-challenge IN CNAME _acme-challenge.dynamic.orbekk.com.
38th IN CNAME orbekk.duckdns.org.
+d IN CNAME dragon.dynamic.orbekk.com.
wifi IN CNAME dragon.dynamic.orbekk.com.
git IN CNAME dragon.dynamic.orbekk.com.
hydra IN CNAME dragon.dynamic.orbekk.com.
diff --git a/machines/dragon.nix b/machines/dragon.nix
index bed3672..2ddd201 100644
--- a/machines/dragon.nix
+++ b/machines/dragon.nix
@@ -25,6 +25,9 @@ in
environment.systemPackages = with pkgs; [ ipmitool ];
programs.mosh.enable = true;
+ orbekk.valheim-server.enable = true;
+ orbekk.valheim-server.programDir = "/opt/valheim";
+
virtualisation.lxd.enable = true;
boot = {
diff --git a/machines/firelink.nix b/machines/firelink.nix
index 392ffc1..180fd79 100644
--- a/machines/firelink.nix
+++ b/machines/firelink.nix
@@ -24,6 +24,7 @@ in
{
orbekk.gaming.enable = true;
orbekk.desktop.enable = true;
+
orbekk.simple-firewall.allowedTCPPorts =
[
# pulseaudio
diff --git a/modules/valheim.nix b/modules/valheim.nix
new file mode 100644
index 0000000..bdfb813
--- /dev/null
+++ b/modules/valheim.nix
@@ -0,0 +1,47 @@
+{ config, lib, pkgs, ... }:
+
+let
+ cfg = config.orbekk.valheim-server;
+ statePath = "/var/lib/${cfg.stateDir}";
+in
+{
+ options = {
+ orbekk.valheim-server = {
+ enable = lib.mkEnableOption "Enable valheim server";
+ programDir = lib.mkOption {
+ type = lib.types.str;
+ default = null;
+ };
+ stateDir = lib.mkOption {
+ type = lib.types.str;
+ default = "valheim";
+ };
+ };
+ };
+
+ config = lib.mkIf cfg.enable {
+ systemd.services.valheim-server = {
+ description = "Valheim server";
+ wantedBy = [ "multi-user.target" ];
+ after = [ "network.target" ];
+ path = with pkgs; [ steam.run ];
+
+ serviceConfig = {
+ DynamicUser = true;
+ StateDirectory = cfg.stateDir;
+ };
+
+ environment = {
+ HOME = statePath;
+ };
+
+ script = ''
+ cd ${cfg.programDir}
+ export templdpath=$LD_LIBRARY_PATH
+ export LD_LIBRARY_PATH=./linux64:$LD_LIBRARY_PATH
+ export SteamAppId=892970
+ steam-run ./valheim_server.x86_64 -name "doomsday" -port 3400 -world "doomsday" -password "$(cat ${statePath}/password.txt)" -savedir ${statePath}
+ '';
+ };
+ };
+}