Compare commits
23
Commits
071b6f0e66
...
trunk
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b7d27d8ea1 | ||
|
|
52641b8b10 | ||
|
|
256a9684fe | ||
|
|
6f74b4aff3 | ||
|
|
ae9a50f11e | ||
|
|
8c9ff95e68 | ||
|
|
b21b81caf4 | ||
|
|
17631704b1 | ||
|
|
cf29da55dc | ||
|
|
4d512e6f6c | ||
|
|
3dbcfe9ff1 | ||
|
|
d196fed0d8 | ||
|
|
491721aed3 | ||
|
|
faceb9d0ca | ||
|
|
8832a4495b | ||
|
|
3e268f4b22 | ||
|
|
c9d30a962c | ||
|
|
7176ce59d2 | ||
|
|
47c160200f | ||
|
|
5e6d4b6344 | ||
|
|
409d84b530 | ||
|
|
60e745a3d9 | ||
|
|
c9dc8a0def |
Generated
+39
-39
@@ -106,16 +106,16 @@
|
|||||||
"brew-src": {
|
"brew-src": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1786945682,
|
"lastModified": 1788591592,
|
||||||
"narHash": "sha256-VBESSoJccikdhxh3vp3SQeG7cZXTOulMvVkoSqNDEhs=",
|
"narHash": "sha256-NbwVKwKLFl0oXub7oPjvmDaOygCtV2oboeKTu4xXFTk=",
|
||||||
"owner": "Homebrew",
|
"owner": "Homebrew",
|
||||||
"repo": "brew",
|
"repo": "brew",
|
||||||
"rev": "5b90e281d4e0c8fbd6ca4d8358276fb305b8d0bd",
|
"rev": "08e85c4e42f5d8f1ea17c36cb59cf61c2ccb26c3",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"owner": "Homebrew",
|
"owner": "Homebrew",
|
||||||
"ref": "6.0.18",
|
"ref": "6.0.22",
|
||||||
"repo": "brew",
|
"repo": "brew",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
@@ -126,11 +126,11 @@
|
|||||||
"nixpkgs": "nixpkgs"
|
"nixpkgs": "nixpkgs"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1787524125,
|
"lastModified": 1789598303,
|
||||||
"narHash": "sha256-P48TOQdIbB0PKMn4FTk6X0utbf0LemNlJ+bFcSbveGA=",
|
"narHash": "sha256-hyAB8PqtE+2NPbXqFWFOVessao4ccpsQq6hKBfZPN0w=",
|
||||||
"owner": "9001",
|
"owner": "9001",
|
||||||
"repo": "copyparty",
|
"repo": "copyparty",
|
||||||
"rev": "9de090265f8d063056320f41d984830839017a2f",
|
"rev": "6867ccc51181e7965445c3d158ddddf9a8fd817e",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -566,11 +566,11 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1787377438,
|
"lastModified": 1789267039,
|
||||||
"narHash": "sha256-Sxu1NLTD/Ern6hFGLlZmtKCSct3YQXZI/lls8RE1XeM=",
|
"narHash": "sha256-LWiBv9yAYFi2LPbUhDGHPGKYskJQjj2fw12OlyO1uQo=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "home-manager",
|
"repo": "home-manager",
|
||||||
"rev": "65258d5c65a250189fde2e35f490d15e064c4c62",
|
"rev": "ec172013fa62135f58fb58dd17ae9651e8f39727",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -587,11 +587,11 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1787750582,
|
"lastModified": 1789676441,
|
||||||
"narHash": "sha256-FfIAV44k33i+IjC1+new2KyjyVGUzGtV89VHVP4eK1U=",
|
"narHash": "sha256-mOvO5VvycuBtOUe5EYI54vrLsWe+2KF/82fmwKooe48=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "home-manager",
|
"repo": "home-manager",
|
||||||
"rev": "0a364342a66bcecfc8a00d2fc38c6c29eee7bc5e",
|
"rev": "9d485f74cd27d17126ee34cb31005c39d20f741f",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -753,11 +753,11 @@
|
|||||||
"brew-src": "brew-src"
|
"brew-src": "brew-src"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1787330919,
|
"lastModified": 1788981439,
|
||||||
"narHash": "sha256-LslMncqN7uOOH5S88WZtO/EVt2HwD8ltUnfyANk+mC0=",
|
"narHash": "sha256-fEaFq0XgpgWFPLfpq1UK4/8ylHd2T0+fo6O3hKz1LUM=",
|
||||||
"owner": "zhaofengli",
|
"owner": "zhaofengli",
|
||||||
"repo": "nix-homebrew",
|
"repo": "nix-homebrew",
|
||||||
"rev": "b00218e4aec0e5bf07d61a0bb13f842faa582d7b",
|
"rev": "09a921d0181146cf6163ec2cc1db7b6fd539a885",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -806,11 +806,11 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1784642409,
|
"lastModified": 1789164534,
|
||||||
"narHash": "sha256-hcbDqFuySAJawljt5r0sKBCJKYnbtGD0T/ZIozH1Dq0=",
|
"narHash": "sha256-DoYGPM6QpnYBLWj9gGw6ZwAzIX+HrAVov1BoT+8Jixo=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "NixOS-WSL",
|
"repo": "NixOS-WSL",
|
||||||
"rev": "eaeb18da90024448a60eb1ec7132eafa4003404e",
|
"rev": "72c92b11bb8289e6651c7fef29cc0a885fd6a255",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -837,11 +837,11 @@
|
|||||||
},
|
},
|
||||||
"nixpkgs-unstable": {
|
"nixpkgs-unstable": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1787498568,
|
"lastModified": 1789546076,
|
||||||
"narHash": "sha256-FoOSoBG7tEvOlGRTpWnVdY506Ner4y7r7UYO3OGgmE8=",
|
"narHash": "sha256-vWkSk5bbfTqdtMoSgD9FshACO8JCvXTFi+3cqEp0mH0=",
|
||||||
"rev": "56c02bc00adcf003215cc4bd996d6efaf4cff188",
|
"rev": "b1b875982b17dabde9b4a37f3e229e74913e6db3",
|
||||||
"type": "tarball",
|
"type": "tarball",
|
||||||
"url": "https://releases.nixos.org/nixos/unstable/nixos-26.11pre1060451.56c02bc00adc/nixexprs.tar.xz"
|
"url": "https://releases.nixos.org/nixos/unstable/nixos-26.11pre1074753.b1b875982b17/nixexprs.tar.zst"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"id": "nixpkgs",
|
"id": "nixpkgs",
|
||||||
@@ -851,11 +851,11 @@
|
|||||||
},
|
},
|
||||||
"nixpkgs_2": {
|
"nixpkgs_2": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1787640266,
|
"lastModified": 1789542786,
|
||||||
"narHash": "sha256-tbu/95O8ZRmCj0kfSiDvz3YT7GSnD0fO6cxLRVYtXnU=",
|
"narHash": "sha256-BGtBoaZNpOPDEBLTiWNFdYppnDjGhwrUq5/P15QwrrM=",
|
||||||
"rev": "f4f698677b11021a8f84f452e23ae9ef2427bec3",
|
"rev": "4c7870105e7f1fdf9c48688c8d7efc21abf0688a",
|
||||||
"type": "tarball",
|
"type": "tarball",
|
||||||
"url": "https://releases.nixos.org/nixos/26.05/nixos-26.05.8409.f4f698677b11/nixexprs.tar.xz"
|
"url": "https://releases.nixos.org/nixos/26.05/nixos-26.05.9904.4c7870105e7f/nixexprs.tar.zst"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"id": "nixpkgs",
|
"id": "nixpkgs",
|
||||||
@@ -944,11 +944,11 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1787514376,
|
"lastModified": 1789510188,
|
||||||
"narHash": "sha256-wS5a1tumQcmwamA4BpSvf2Idd/P/zOQNU1hY53EzfoM=",
|
"narHash": "sha256-umec9LKkWjK89Yx4XpvQStkgfKvhK7GjVf5m21bjzKU=",
|
||||||
"owner": "notashelf",
|
"owner": "notashelf",
|
||||||
"repo": "nvf",
|
"repo": "nvf",
|
||||||
"rev": "460dad9e777df4008309f1d731a47b299dc7b41e",
|
"rev": "cdc7e7aaa7eb521bba1b38f54c3228d52cc31703",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -1235,11 +1235,11 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1786629091,
|
"lastModified": 1789623319,
|
||||||
"narHash": "sha256-gkig4nPi1CWc4Z50GBsjE4ygSE7hMpl/TwID2an2Cck=",
|
"narHash": "sha256-kmlp8rPrvrXn58YiaANHKSWUijtUc7pwgerIywosOIM=",
|
||||||
"owner": "Mic92",
|
"owner": "Mic92",
|
||||||
"repo": "sops-nix",
|
"repo": "sops-nix",
|
||||||
"rev": "a8627b21b9107c5711c96b84f32a9a4b3d45295f",
|
"rev": "16954c1c360c3dc4d4b3b3e64df59f7e89452cb1",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -1334,11 +1334,11 @@
|
|||||||
"tinted-zed": "tinted-zed"
|
"tinted-zed": "tinted-zed"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1787175104,
|
"lastModified": 1787771653,
|
||||||
"narHash": "sha256-tzNjlb0loxeWlipvxSNAUUihloeTZoyGFhEen87yM9k=",
|
"narHash": "sha256-DkkJSBOXWV/mja5Vy8az5g1KpZlsbUwlmH0BsQhowaQ=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "stylix",
|
"repo": "stylix",
|
||||||
"rev": "a9e5a76a1b75b137f266e4f445e1eaba82e9783e",
|
"rev": "5e3809851f486e7fc7e84b40f174c74b60ecc784",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -1450,11 +1450,11 @@
|
|||||||
},
|
},
|
||||||
"vpn-confinement": {
|
"vpn-confinement": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1785142579,
|
"lastModified": 1789394839,
|
||||||
"narHash": "sha256-WEPxDMiKt3uGVVu/aorHnIgYYW62mEq2Q+rlN3qH6bg=",
|
"narHash": "sha256-trdjVJKmDBbzgbP8pd+R7iKbGkdRu0nmXgQlBR/hEiU=",
|
||||||
"owner": "Maroka-chan",
|
"owner": "Maroka-chan",
|
||||||
"repo": "VPN-Confinement",
|
"repo": "VPN-Confinement",
|
||||||
"rev": "b3aa71a7edfe6af748c23729d1bdec3b499741ff",
|
"rev": "a21f66ccd9f644c3770ccdf287cb380c00192628",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
#../../../modules/gameservers/srcds
|
#../../../modules/gameservers/srcds
|
||||||
../../../modules/gameservers/minecraft_recpro
|
../../../modules/gameservers/minecraft_recpro
|
||||||
../../../modules/gameservers/minecraft_modded
|
../../../modules/gameservers/minecraft_modded
|
||||||
|
../../../modules/gameservers/valheim
|
||||||
];
|
];
|
||||||
|
|
||||||
home-manager.users.blake.imports = [
|
home-manager.users.blake.imports = [
|
||||||
@@ -91,6 +92,7 @@
|
|||||||
gameservers = {
|
gameservers = {
|
||||||
minecraft_recpro.enable = true;
|
minecraft_recpro.enable = true;
|
||||||
minecraft_modded.enable = false;
|
minecraft_modded.enable = false;
|
||||||
|
valheim.enable = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
# boot (systemd is going on me)
|
# boot (systemd is going on me)
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ in {
|
|||||||
enable = true;
|
enable = true;
|
||||||
allowedTCPPorts = [22 80 443 25777 25579 7567 21115 21116 21117 21118 21119];
|
allowedTCPPorts = [22 80 443 25777 25579 7567 21115 21116 21117 21118 21119];
|
||||||
# tailscale will also need its UDP port open:
|
# tailscale will also need its UDP port open:
|
||||||
allowedUDPPorts = [config.services.tailscale.port 25777 21116 25580];
|
allowedUDPPorts = [config.services.tailscale.port 2456 2457 25777 21116 25580];
|
||||||
trustedInterfaces = ["tailscale0"];
|
trustedInterfaces = ["tailscale0"];
|
||||||
/*
|
/*
|
||||||
iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j DNAT --to-destination ${snowbelle_ip}:80 # http
|
iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j DNAT --to-destination ${snowbelle_ip}:80 # http
|
||||||
@@ -146,12 +146,16 @@ in {
|
|||||||
iptables -t nat -A PREROUTING -i eth0 -p udp --dport 25777 -j DNAT --to-destination ${lumiose_ip}:25777 # recpro mc
|
iptables -t nat -A PREROUTING -i eth0 -p udp --dport 25777 -j DNAT --to-destination ${lumiose_ip}:25777 # recpro mc
|
||||||
iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 25579 -j DNAT --to-destination ${snowbelle_ip}:25579 # craftoria mc
|
iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 25579 -j DNAT --to-destination ${snowbelle_ip}:25579 # craftoria mc
|
||||||
iptables -t nat -A PREROUTING -i eth0 -p udp --dport 25580 -j DNAT --to-destination ${snowbelle_ip}:25580 # craftoria mc voice chat
|
iptables -t nat -A PREROUTING -i eth0 -p udp --dport 25580 -j DNAT --to-destination ${snowbelle_ip}:25580 # craftoria mc voice chat
|
||||||
|
iptables -t nat -A PREROUTING -i eth0 -p udp --dport 2456 -j DNAT --to-destination ${lumiose_ip}:2456 # valheim server
|
||||||
|
iptables -t nat -A PREROUTING -i eth0 -p udp --dport 2457 -j DNAT --to-destination ${lumiose_ip}:2457 # valheim server
|
||||||
|
|
||||||
# SNAT: ensure replies go back through VPS tailscale IP
|
# SNAT: ensure replies go back through VPS tailscale IP
|
||||||
iptables -t nat -A POSTROUTING -o tailscale0 -p tcp --dport 25777 -d ${lumiose_ip}/32 -j SNAT --to-source ${vpsip4} # recpro mc
|
iptables -t nat -A POSTROUTING -o tailscale0 -p tcp --dport 25777 -d ${lumiose_ip}/32 -j SNAT --to-source ${vpsip4} # recpro mc
|
||||||
iptables -t nat -A POSTROUTING -o tailscale0 -p udp --dport 25777 -d ${lumiose_ip}/32 -j SNAT --to-source ${vpsip4} # recpro mc
|
iptables -t nat -A POSTROUTING -o tailscale0 -p udp --dport 25777 -d ${lumiose_ip}/32 -j SNAT --to-source ${vpsip4} # recpro mc
|
||||||
iptables -t nat -A POSTROUTING -o tailscale0 -p tcp --dport 25579 -d ${snowbelle_ip}/32 -j SNAT --to-source ${vpsip4} # craftoria mc
|
iptables -t nat -A POSTROUTING -o tailscale0 -p tcp --dport 25579 -d ${snowbelle_ip}/32 -j SNAT --to-source ${vpsip4} # craftoria mc
|
||||||
iptables -t nat -A POSTROUTING -o tailscale0 -p udp --dport 25580 -d ${snowbelle_ip}/32 -j SNAT --to-source ${vpsip4} # craftoria mc voicechat
|
iptables -t nat -A POSTROUTING -o tailscale0 -p udp --dport 25580 -d ${snowbelle_ip}/32 -j SNAT --to-source ${vpsip4} # craftoria mc voicechat
|
||||||
|
iptables -t nat -A POSTROUTING -o tailscale0 -p udp --dport 2456 -d ${lumiose_ip}/32 -j SNAT --to-source ${vpsip4} # valheim server
|
||||||
|
iptables -t nat -A POSTROUTING -o tailscale0 -p udp --dport 2457 -d ${lumiose_ip}/32 -j SNAT --to-source ${vpsip4} # valheim server
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -13,20 +13,20 @@ in {
|
|||||||
};
|
};
|
||||||
|
|
||||||
config = lib.mkIf cfg.enable {
|
config = lib.mkIf cfg.enable {
|
||||||
services.tailscale = {
|
# services.tailscale = {
|
||||||
enable = true;
|
# enable = true;
|
||||||
#overrideLocalDns = true;
|
# #overrideLocalDns = true;
|
||||||
#authKeyFile = authkey_file;
|
# #authKeyFile = authkey_file;
|
||||||
};
|
# };
|
||||||
|
|
||||||
# environment.systemPackages = with pkgs; [
|
# environment.systemPackages = with pkgs; [
|
||||||
# tailscale-gui
|
# tailscale-gui
|
||||||
# ];
|
# ];
|
||||||
|
|
||||||
homebrew = {
|
# homebrew = {
|
||||||
casks = [
|
# casks = [
|
||||||
"tailscale-app"
|
# "tailscale-app"
|
||||||
];
|
# ];
|
||||||
};
|
# };
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,11 +13,11 @@ in {
|
|||||||
};
|
};
|
||||||
|
|
||||||
config = lib.mkIf cfg.enable {
|
config = lib.mkIf cfg.enable {
|
||||||
services.tailscale = {
|
# services.tailscale = {
|
||||||
enable = true;
|
# enable = true;
|
||||||
#overrideLocalDns = true;
|
# #overrideLocalDns = true;
|
||||||
#authKeyFile = authkey_file;
|
# #authKeyFile = authkey_file;
|
||||||
};
|
# };
|
||||||
|
|
||||||
homebrew = {
|
homebrew = {
|
||||||
casks = [
|
casks = [
|
||||||
|
|||||||
@@ -38,14 +38,14 @@ in {
|
|||||||
path = "/holocron/users/blake/holocron";
|
path = "/holocron/users/blake/holocron";
|
||||||
devices = ["piplup" "zygarde" "CEN-IT-07" "CEN-IT-00007" "yveltal"];
|
devices = ["piplup" "zygarde" "CEN-IT-07" "CEN-IT-00007" "yveltal"];
|
||||||
id = "5voxg-c3he2";
|
id = "5voxg-c3he2";
|
||||||
versioning = {
|
# versioning = {
|
||||||
type = "staggered";
|
# type = "staggered";
|
||||||
fsPath = "/holocron/users/blake/holocron/.stversions";
|
# fsPath = "/holocron/users/blake/holocron/.stversions";
|
||||||
params = {
|
# params = {
|
||||||
cleanInterval = "3600";
|
# cleanInterval = "3600";
|
||||||
maxAge = "0";
|
# maxAge = "0";
|
||||||
};
|
# };
|
||||||
};
|
# };
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
options = {
|
options = {
|
||||||
|
|||||||
@@ -0,0 +1,149 @@
|
|||||||
|
{
|
||||||
|
pkgs,
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
inputs,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
nixservice = "podman-valheim";
|
||||||
|
service = "valheim";
|
||||||
|
cfg = config.gameservers.${service};
|
||||||
|
sec = config.sops.secrets;
|
||||||
|
homelab = config.homelab;
|
||||||
|
in {
|
||||||
|
options.gameservers.${service} = {
|
||||||
|
enable = lib.mkEnableOption "enables ${service}";
|
||||||
|
# set port options
|
||||||
|
port = lib.mkOption {
|
||||||
|
type = lib.types.int;
|
||||||
|
default = 2456;
|
||||||
|
description = "set port for ${service} (default: ${toString cfg.port}";
|
||||||
|
};
|
||||||
|
url = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
default = "${service}.${homelab.base_domain}";
|
||||||
|
description = "set domain for ${service}";
|
||||||
|
};
|
||||||
|
data_dir = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
default = "/var/lib/gameservers/${service}";
|
||||||
|
description = "set data directory for ${service}";
|
||||||
|
};
|
||||||
|
ids = lib.mkOption {
|
||||||
|
type = lib.types.int;
|
||||||
|
default = cfg.port;
|
||||||
|
description = "set uid and pid of ${service} user (matches port by default)";
|
||||||
|
};
|
||||||
|
motd_gs = lib.mkOption {
|
||||||
|
type = lib.types.nullOr (lib.types.listOf lib.types.str);
|
||||||
|
default = ["podman-valheim"];
|
||||||
|
};
|
||||||
|
backup = lib.mkOption {
|
||||||
|
type = lib.types.bool;
|
||||||
|
default = false;
|
||||||
|
description = "enable backups for ${service}";
|
||||||
|
};
|
||||||
|
backup_repo = lib.mkOption {
|
||||||
|
type = lib.types.path;
|
||||||
|
default = "/var/backup/gameservers/valheim";
|
||||||
|
description = "path to take hourly backups to with borg!";
|
||||||
|
};
|
||||||
|
offsite_user = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
default = "lifeboat";
|
||||||
|
description = "user to connect to offsite host with";
|
||||||
|
};
|
||||||
|
offsite_target = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
default = "lifeboat.holocron.blue";
|
||||||
|
description = "ip or domain for offsite backups";
|
||||||
|
};
|
||||||
|
offsite_dir = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
default = "lifeboat/holocron/archives/gameservers";
|
||||||
|
description = "path to rsync offsite backups to";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf cfg.enable {
|
||||||
|
# declare ${service} group
|
||||||
|
users.groups.${service} = {gid = lib.mkForce cfg.ids;};
|
||||||
|
|
||||||
|
# declare ${service} user
|
||||||
|
users.users.${service} = {
|
||||||
|
description = "${service} server user";
|
||||||
|
uid = lib.mkForce cfg.ids;
|
||||||
|
isSystemUser = true;
|
||||||
|
home = cfg.data_dir;
|
||||||
|
createHome = true;
|
||||||
|
group = service;
|
||||||
|
extraGroups = [];
|
||||||
|
};
|
||||||
|
|
||||||
|
virtualisation.oci-containers.containers = {
|
||||||
|
${service} = {
|
||||||
|
image = "ghcr.io/community-valheim-tools/valheim-server";
|
||||||
|
autoStart = true;
|
||||||
|
extraOptions = [
|
||||||
|
"--cap-add=sys_nice"
|
||||||
|
"--stop-timeout=120"
|
||||||
|
];
|
||||||
|
ports = [
|
||||||
|
"2456-2457:2456-2457/udp"
|
||||||
|
"2456:80/tcp"
|
||||||
|
];
|
||||||
|
volumes = [
|
||||||
|
"${cfg.data_dir}/config:/config"
|
||||||
|
"${cfg.data_dir}/data:/opt/valheim"
|
||||||
|
];
|
||||||
|
environment = {
|
||||||
|
SERVER_NAME = "recpro";
|
||||||
|
SERVER_PASS = "recoil727pro";
|
||||||
|
#WORLD_NAME = "";
|
||||||
|
STATUS_HTTP = "true";
|
||||||
|
TZ = homelab.tz;
|
||||||
|
PUID = toString config.users.users.${service}.uid;
|
||||||
|
PGID = toString config.users.groups.${service}.gid;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# override umask to make permissions work out
|
||||||
|
systemd.services.${service}.serviceConfig = {
|
||||||
|
UMask = lib.mkForce "0007";
|
||||||
|
};
|
||||||
|
|
||||||
|
# open firewall
|
||||||
|
networking.firewall.allowedTCPPorts = [cfg.port];
|
||||||
|
networking.firewall.allowedUDPPorts = [2456 2457];
|
||||||
|
|
||||||
|
# backups valhiem with borg!
|
||||||
|
services.borgbackup.jobs.${service} = {
|
||||||
|
archiveBaseName = service;
|
||||||
|
repo = cfg.backup_repo;
|
||||||
|
paths = cfg.data_dir;
|
||||||
|
compression = "auto,zstd";
|
||||||
|
#preHook = "systemctl start mysql-backup.service";
|
||||||
|
postHook = ''
|
||||||
|
${pkgs.sshpass}/bin/sshpass -f ${sec."lifeboat_rsync".path} \
|
||||||
|
${pkgs.rsync}/bin/rsync -aHAX --partial --numeric-ids --info=progress2,name1,stats2 --delete \
|
||||||
|
-e "ssh -o StrictHostKeyChecking=no" \
|
||||||
|
${toString cfg.backup_repo} \
|
||||||
|
${cfg.offsite_user}@${cfg.offsite_target}::${cfg.offsite_dir}
|
||||||
|
'';
|
||||||
|
startAt = "*-*-* *:00:00";
|
||||||
|
group = "archives";
|
||||||
|
encryption.mode = "repokey-blake2";
|
||||||
|
encryption.passCommand = "cat ${config.sops.secrets."borg_passwd".path}";
|
||||||
|
extraArgs = ["--verbose" "--show-rc" "--umask" "0007"];
|
||||||
|
extraCreateArgs = ["--list" "--stats" "--filter" "AME"];
|
||||||
|
prune.keep = {
|
||||||
|
within = "1d"; # Keep all archives from the last day
|
||||||
|
hourly = 24;
|
||||||
|
daily = 7;
|
||||||
|
weekly = 12;
|
||||||
|
monthly = -1; # Keep at least one archive for each month
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -62,6 +62,7 @@ in {
|
|||||||
# enable the ${service} service
|
# enable the ${service} service
|
||||||
services.${service} = {
|
services.${service} = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
package = pkgs.unstable.jellyfin;
|
||||||
openFirewall = true;
|
openFirewall = true;
|
||||||
user = service;
|
user = service;
|
||||||
group = service;
|
group = service;
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ in {
|
|||||||
plugins = [
|
plugins = [
|
||||||
"github.com/caddy-dns/cloudflare@v0.2.4"
|
"github.com/caddy-dns/cloudflare@v0.2.4"
|
||||||
];
|
];
|
||||||
hash = "sha256-PWadA5qr/gR2qDcT8l8u1Xku7LM2HIfWTLOkzezCYy0=";
|
hash = "sha256-dQvk6ezY6TQ1J7PjhCXnThF/SqVgPwBO8/RXzHCY+js=";
|
||||||
# Replace with the hash from the build error the first time you build.
|
# Replace with the hash from the build error the first time you build.
|
||||||
};
|
};
|
||||||
email = "me@blakedheld.xyz";
|
email = "me@blakedheld.xyz";
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ in {
|
|||||||
"superflat.recoil.pro"
|
"superflat.recoil.pro"
|
||||||
"skyblock.recoil.pro"
|
"skyblock.recoil.pro"
|
||||||
"cobblemon.recoil.pro"
|
"cobblemon.recoil.pro"
|
||||||
|
"valheim.recoil.pro"
|
||||||
|
|
||||||
# blakedheld.xyz
|
# blakedheld.xyz
|
||||||
#"blakedheld.xyz"
|
#"blakedheld.xyz"
|
||||||
|
|||||||
@@ -0,0 +1,125 @@
|
|||||||
|
{
|
||||||
|
pkgs,
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
inputs,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
nixservice = "wger";
|
||||||
|
service = "wger";
|
||||||
|
cfg = config.homelab.${service};
|
||||||
|
sec = config.sops.secrets;
|
||||||
|
homelab = config.homelab;
|
||||||
|
in {
|
||||||
|
options.homelab.${service} = {
|
||||||
|
enable = lib.mkEnableOption "enables ${service}";
|
||||||
|
|
||||||
|
# set port options
|
||||||
|
port = lib.mkOption {
|
||||||
|
type = lib.types.int;
|
||||||
|
default = 7707;
|
||||||
|
description = "set port for ${service} (default: ${toString cfg.port}";
|
||||||
|
};
|
||||||
|
url = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
default = "${service}.${homelab.base_domain}";
|
||||||
|
description = "set domain for ${service}";
|
||||||
|
};
|
||||||
|
data_dir = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
default = "/var/lib/${service}";
|
||||||
|
description = "set data directory for ${service}";
|
||||||
|
};
|
||||||
|
ids = lib.mkOption {
|
||||||
|
type = lib.types.int;
|
||||||
|
default = cfg.port;
|
||||||
|
description = "set uid and pid of ${service} user (matches port by default)";
|
||||||
|
};
|
||||||
|
backup = lib.mkOption {
|
||||||
|
type = lib.types.bool;
|
||||||
|
default = true;
|
||||||
|
description = "enable backups for ${service}";
|
||||||
|
};
|
||||||
|
motd = lib.mkOption {
|
||||||
|
type = lib.types.nullOr lib.types.str;
|
||||||
|
default = "podman-wger";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf cfg.enable {
|
||||||
|
# declare ${service} group
|
||||||
|
users.groups.${service} = {gid = lib.mkForce cfg.ids;};
|
||||||
|
|
||||||
|
# declare ${service} user
|
||||||
|
users.users.${service} = {
|
||||||
|
description = "${service} server user";
|
||||||
|
uid = lib.mkForce cfg.ids;
|
||||||
|
isSystemUser = true;
|
||||||
|
home = cfg.data_dir;
|
||||||
|
createHome = true;
|
||||||
|
group = service;
|
||||||
|
extraGroups = [];
|
||||||
|
};
|
||||||
|
|
||||||
|
# still suss as fuck bro man fuck
|
||||||
|
virtualisation.oci-containers.containers = {
|
||||||
|
hass = {
|
||||||
|
image = "homeassistant/home-assistant:stable";
|
||||||
|
autoStart = true;
|
||||||
|
extraOptions = [
|
||||||
|
"--pull=newer"
|
||||||
|
"--network=host"
|
||||||
|
];
|
||||||
|
volumes = [
|
||||||
|
"${cfg.data_dir}:/config"
|
||||||
|
];
|
||||||
|
environment = {
|
||||||
|
TZ = homelab.tz;
|
||||||
|
PUID = toString config.users.users.${service}.uid;
|
||||||
|
PGID = toString config.users.groups.${service}.gid;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# override umask to make permissions work out
|
||||||
|
systemd.services.${service}.serviceConfig = {
|
||||||
|
UMask = lib.mkForce "0007";
|
||||||
|
};
|
||||||
|
|
||||||
|
# open firewall
|
||||||
|
networking.firewall.allowedTCPPorts = [cfg.port 8123 21063 21064];
|
||||||
|
networking.firewall.allowedUDPPorts = [5353];
|
||||||
|
|
||||||
|
# add to caddy for reverse proxy
|
||||||
|
services.caddy.virtualHosts."${cfg.url}" = {
|
||||||
|
serverAliases = ["${service}.${homelab.public_domain}"];
|
||||||
|
extraConfig = ''
|
||||||
|
tls internal
|
||||||
|
reverse_proxy 127.0.0.1:${toString cfg.port} {
|
||||||
|
|
||||||
|
header_up Host {host}
|
||||||
|
header_up X-Real-IP {remote_host}
|
||||||
|
header_up X-Forwarded-For {remote_host}
|
||||||
|
header_up X-Forwarded-Proto https
|
||||||
|
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
# add to glance
|
||||||
|
homelab.glance.links.services = [
|
||||||
|
{
|
||||||
|
title = "wger";
|
||||||
|
url = "https://hass.${homelab.public_domain}";
|
||||||
|
error-url = "http://${homelab.host_ip}:${toString cfg.port}";
|
||||||
|
check-url = "http://${homelab.host_ip}:${toString cfg.port}";
|
||||||
|
icon = "di:${nixservice}";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
# add to backups
|
||||||
|
homelab.backups.baks = {
|
||||||
|
${service} = {paths = [cfg.data_dir];};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user