refactor folder structure
This commit is contained in:
44
hosts/fw/modules/palworld.nix
Normal file
44
hosts/fw/modules/palworld.nix
Normal file
@@ -0,0 +1,44 @@
|
||||
{ config, pkgs, ... }:
|
||||
|
||||
{
|
||||
virtualisation.oci-containers.backend = "podman";
|
||||
virtualisation.oci-containers.containers = {
|
||||
palworld = {
|
||||
image = "thijsvanloef/palworld-server-docker:latest";
|
||||
autoStart = false;
|
||||
ports = [
|
||||
"8211:8211/udp"
|
||||
"27015:27015/udp"
|
||||
];
|
||||
environmentFiles = [
|
||||
config.sops.secrets.palworld.path
|
||||
];
|
||||
volumes = [
|
||||
"/var/lib/palworld/:/palworld/"
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
systemd.timers."restart-palworld" = {
|
||||
wantedBy = [ "timers.target" ];
|
||||
timerConfig = {
|
||||
OnCalendar = "*-*-* 3:00:00";
|
||||
Unit = "restart-palworld.service";
|
||||
};
|
||||
};
|
||||
|
||||
systemd.services."restart-palworld" = {
|
||||
script = ''
|
||||
set -eu
|
||||
if ${pkgs.systemd}/bin/systemctl is-active --quiet podman-palworld.service; then
|
||||
${pkgs.systemd}/bin/systemctl restart podman-palworld.service
|
||||
fi
|
||||
'';
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
User = "root";
|
||||
};
|
||||
};
|
||||
|
||||
sops.secrets.palworld = {};
|
||||
}
|
||||
Reference in New Issue
Block a user