refactor: use simple instead of oneshot type for systemd
All checks were successful
Discord / discord commits (push) Has been skipped
All checks were successful
Discord / discord commits (push) Has been skipped
This commit is contained in:
parent
2a8eb46b03
commit
52242e645a
4 changed files with 33 additions and 22 deletions
|
@ -21,7 +21,6 @@ in {
|
||||||
systemd = {
|
systemd = {
|
||||||
services.manage-subs = {
|
services.manage-subs = {
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
Type = "oneshot";
|
|
||||||
User = mainUser;
|
User = mainUser;
|
||||||
Group = config.users.users.${mainUser}.group;
|
Group = config.users.users.${mainUser}.group;
|
||||||
};
|
};
|
||||||
|
|
|
@ -9,10 +9,10 @@ in {
|
||||||
../../modules/sshd.nix
|
../../modules/sshd.nix
|
||||||
../../modules/tailscale.nix
|
../../modules/tailscale.nix
|
||||||
|
|
||||||
|
./modules/7-days-to-die.nix
|
||||||
./modules/binary-cache.nix
|
./modules/binary-cache.nix
|
||||||
./modules/minecraft.nix
|
./modules/minecraft.nix
|
||||||
./modules/nfs.nix
|
./modules/nfs.nix
|
||||||
./modules/steam-servers
|
|
||||||
];
|
];
|
||||||
|
|
||||||
vars = {
|
vars = {
|
||||||
|
|
32
devices/servivi/modules/7-days-to-die.nix
Normal file
32
devices/servivi/modules/7-days-to-die.nix
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
{pkgs, ...}: let
|
||||||
|
gamePath = "/var/lib/steam-servers/7-days-to-die";
|
||||||
|
relativeConfig = "serverconfig-7days.xml";
|
||||||
|
in {
|
||||||
|
systemd.extraConfig = "DefaultLimitNOFILE=10240";
|
||||||
|
|
||||||
|
# https://github.com/Krutonium/NewNix/blob/455aafc4caf553248ca228f844f021cecf494dc2/services/sevendaystodie.nix#L6
|
||||||
|
systemd.services."7-days-to-die" = {
|
||||||
|
wantedBy = ["multi-user.target"];
|
||||||
|
serviceConfig.User = "matt";
|
||||||
|
|
||||||
|
path = with pkgs; [
|
||||||
|
steam-run
|
||||||
|
steamcmd
|
||||||
|
];
|
||||||
|
|
||||||
|
script = ''
|
||||||
|
# Make sure gamePath exists and cd to it
|
||||||
|
mkdir -p ${gamePath}
|
||||||
|
cd ${gamePath}
|
||||||
|
|
||||||
|
# Install / Update server
|
||||||
|
steamcmd +force_install_dir ${gamePath} \
|
||||||
|
+login anonymous +app_update 294420 \
|
||||||
|
-beta latest_experimental \
|
||||||
|
+quit
|
||||||
|
|
||||||
|
# Launch server
|
||||||
|
steam-run ./startserver.sh -configfile=${relativeConfig}
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
}
|
|
@ -1,20 +0,0 @@
|
||||||
{pkgs, ...}: let
|
|
||||||
gamePath = "/var/lib/steam-servers/7-days-to-die";
|
|
||||||
in {
|
|
||||||
systemd.extraConfig = "DefaultLimitNOFILE=10240";
|
|
||||||
|
|
||||||
# https://github.com/Krutonium/NewNix/blob/455aafc4caf553248ca228f844f021cecf494dc2/services/sevendaystodie.nix#L6
|
|
||||||
systemd.services."7daystodie" = {
|
|
||||||
wantedBy = ["multi-user.target"];
|
|
||||||
serviceConfig.Type = "oneshot";
|
|
||||||
serviceConfig.User = "matt";
|
|
||||||
|
|
||||||
path = with pkgs; [steam-run steamcmd];
|
|
||||||
script = ''
|
|
||||||
mkdir -p ${gamePath}
|
|
||||||
cd ${gamePath}
|
|
||||||
steamcmd +force_install_dir ${gamePath} +login anonymous +app_update 294420 -beta latest_experimental +quit
|
|
||||||
steam-run ./startserver.sh -configfile=serverconfig-7days.xml
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
}
|
|
Loading…
Reference in a new issue