From 2a8eb46b035d167e074d5e31eced9551a8850ceb Mon Sep 17 00:00:00 2001 From: matt1432 Date: Sat, 6 Jul 2024 23:55:05 -0400 Subject: [PATCH] feat(servers): make 7 Days to Die server work --- .../servivi/modules/steam-servers/default.nix | 49 ++-- flake.lock | 238 ------------------ flake.nix | 6 - inputs.nix | 5 - lib.nix | 1 - 5 files changed, 16 insertions(+), 283 deletions(-) diff --git a/devices/servivi/modules/steam-servers/default.nix b/devices/servivi/modules/steam-servers/default.nix index a747186b..b575d2f7 100644 --- a/devices/servivi/modules/steam-servers/default.nix +++ b/devices/servivi/modules/steam-servers/default.nix @@ -1,37 +1,20 @@ -{ - pkgs, - steam-servers, - ... -}: { - imports = [steam-servers.nixosModules.default]; +{pkgs, ...}: let + gamePath = "/var/lib/steam-servers/7-days-to-die"; +in { + systemd.extraConfig = "DefaultLimitNOFILE=10240"; - services.steam-servers."7-days-to-die" = { - mainServ = { - enable = true; - package = - steam-servers - .packages - .${pkgs.system} - ."7-days-to-die" - .branches - .latest_experimental; + # https://github.com/Krutonium/NewNix/blob/455aafc4caf553248ca228f844f021cecf494dc2/services/sevendaystodie.nix#L6 + systemd.services."7daystodie" = { + wantedBy = ["multi-user.target"]; + serviceConfig.Type = "oneshot"; + serviceConfig.User = "matt"; - config = { - ServerName = "bruh moment"; - ServerPort = 26900; - - # removed in v1.0 - SaveGameFolder = null; - - BlockDamagePlayer = 200; - BloodMoonEnemyCount = 10; - DropOnDeath = 3; - PartySharedKillRange = 10000; - PlayerKillingMode = 2; - XPMultiplier = 200; - ZombieBMMove = 1; - ZombieMoveNight = 0; - }; - }; + 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 + ''; }; } diff --git a/flake.lock b/flake.lock index dbc68d22..44894c8a 100644 --- a/flake.lock +++ b/flake.lock @@ -171,28 +171,6 @@ "type": "github" } }, - "devshell": { - "inputs": { - "flake-utils": "flake-utils_4", - "nixpkgs": [ - "steam-servers", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1717408969, - "narHash": "sha256-Q0OEFqe35fZbbRPPRdrjTUUChKVhhWXz3T9ZSKmaoVY=", - "owner": "numtide", - "repo": "devshell", - "rev": "1ebbe68d57457c8cae98145410b164b5477761f4", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "devshell", - "type": "github" - } - }, "discord-overlay": { "inputs": { "Vencord-src": "Vencord-src", @@ -326,22 +304,6 @@ "type": "github" } }, - "flake-compat_5": { - "flake": false, - "locked": { - "lastModified": 1696426674, - "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", - "owner": "edolstra", - "repo": "flake-compat", - "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", - "type": "github" - }, - "original": { - "owner": "edolstra", - "repo": "flake-compat", - "type": "github" - } - }, "flake-parts": { "inputs": { "nixpkgs-lib": [ @@ -363,27 +325,6 @@ "type": "github" } }, - "flake-parts_10": { - "inputs": { - "nixpkgs-lib": [ - "steam-servers", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1719877454, - "narHash": "sha256-g5N1yyOSsPNiOlFfkuI/wcUjmtah+nxdImJqrSATjOU=", - "owner": "hercules-ci", - "repo": "flake-parts", - "rev": "4e3583423212f9303aa1a6337f8dffb415920e4f", - "type": "github" - }, - "original": { - "owner": "hercules-ci", - "repo": "flake-parts", - "type": "github" - } - }, "flake-parts_2": { "inputs": { "nixpkgs-lib": [ @@ -559,21 +500,6 @@ "type": "github" } }, - "flake-root_2": { - "locked": { - "lastModified": 1713493429, - "narHash": "sha256-ztz8JQkI08tjKnsTpfLqzWoKFQF4JGu2LRz8bkdnYUk=", - "owner": "srid", - "repo": "flake-root", - "rev": "bc748b93b86ee76e2032eecda33440ceb2532fcd", - "type": "github" - }, - "original": { - "owner": "srid", - "repo": "flake-root", - "type": "github" - } - }, "flake-utils": { "inputs": { "systems": "systems_3" @@ -628,24 +554,6 @@ "type": "github" } }, - "flake-utils_4": { - "inputs": { - "systems": "systems_7" - }, - "locked": { - "lastModified": 1701680307, - "narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "4022d587cbbfd70fe950c1e2083a02621806a725", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, "flakegen": { "inputs": { "systems": "systems" @@ -751,28 +659,6 @@ "type": "github" } }, - "gitignore_3": { - "inputs": { - "nixpkgs": [ - "steam-servers", - "pre-commit-hooks", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1709087332, - "narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=", - "owner": "hercules-ci", - "repo": "gitignore.nix", - "rev": "637db329424fd7e46cf4185293b9cc8c88c95394", - "type": "github" - }, - "original": { - "owner": "hercules-ci", - "repo": "gitignore.nix", - "type": "github" - } - }, "gpu-screen-recorder-src": { "flake": false, "locked": { @@ -1835,22 +1721,6 @@ "type": "github" } }, - "nixpkgs-stable_4": { - "locked": { - "lastModified": 1718811006, - "narHash": "sha256-0Y8IrGhRmBmT7HHXlxxepg2t8j1X90++qRN3lukGaIk=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "03d771e513ce90147b65fe922d87d3a0356fc125", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixos-23.11", - "repo": "nixpkgs", - "type": "github" - } - }, "nixpkgs-wayland": { "inputs": { "flake-compat": "flake-compat_4", @@ -2113,30 +1983,6 @@ "type": "github" } }, - "pre-commit-hooks_2": { - "inputs": { - "flake-compat": "flake-compat_5", - "gitignore": "gitignore_3", - "nixpkgs": [ - "steam-servers", - "nixpkgs" - ], - "nixpkgs-stable": "nixpkgs-stable_4" - }, - "locked": { - "lastModified": 1719259945, - "narHash": "sha256-F1h+XIsGKT9TkGO3omxDLEb/9jOOsI6NnzsXFsZhry4=", - "owner": "cachix", - "repo": "pre-commit-hooks.nix", - "rev": "0ff4381bbb8f7a52ca4a851660fc7a437a4c6e07", - "type": "github" - }, - "original": { - "owner": "cachix", - "repo": "pre-commit-hooks.nix", - "type": "github" - } - }, "root": { "inputs": { "Hyprspace": "Hyprspace", @@ -2192,7 +2038,6 @@ "secrets": "secrets", "sioyek-theme-src": "sioyek-theme-src", "sops-nix": "sops-nix_2", - "steam-servers": "steam-servers", "stylelint-lsp": "stylelint-lsp", "subsync": "subsync", "trash-d-src": "trash-d-src", @@ -2313,53 +2158,6 @@ "type": "github" } }, - "steam-fetcher": { - "inputs": { - "nixpkgs": [ - "steam-servers", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1714795926, - "narHash": "sha256-PkgC9jqoN6cJ8XYzTA2PlrWs7aPJkM3BGiTxNqax0cA=", - "owner": "aidalgol", - "repo": "nix-steam-fetcher", - "rev": "12f66eafb7862d91b3e30c14035f96a21941bd9c", - "type": "github" - }, - "original": { - "owner": "aidalgol", - "repo": "nix-steam-fetcher", - "type": "github" - } - }, - "steam-servers": { - "inputs": { - "devshell": "devshell", - "flake-parts": "flake-parts_10", - "flake-root": "flake-root_2", - "nixpkgs": [ - "nixpkgs" - ], - "pre-commit-hooks": "pre-commit-hooks_2", - "steam-fetcher": "steam-fetcher", - "treefmt-nix": "treefmt-nix_4" - }, - "locked": { - "lastModified": 1719989577, - "narHash": "sha256-e274clgG6fLiv6iko+qfHfjPAMtmbEXFncA/fsubOFg=", - "owner": "matt1432", - "repo": "nix-steam-servers", - "rev": "acfa5b03f338a460bec7509794aad2be8002f37b", - "type": "github" - }, - "original": { - "owner": "matt1432", - "repo": "nix-steam-servers", - "type": "github" - } - }, "stylelint-lsp": { "inputs": { "nixpkgs": [ @@ -2493,21 +2291,6 @@ "type": "github" } }, - "systems_7": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } - }, "trash-d-src": { "flake": false, "locked": { @@ -2588,27 +2371,6 @@ "type": "github" } }, - "treefmt-nix_4": { - "inputs": { - "nixpkgs": [ - "steam-servers", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1719887753, - "narHash": "sha256-p0B2r98UtZzRDM5miGRafL4h7TwGRC4DII+XXHDHqek=", - "owner": "numtide", - "repo": "treefmt-nix", - "rev": "bdb6355009562d8f9313d9460c0d3860f525bc6c", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "treefmt-nix", - "type": "github" - } - }, "vimplugin-easytables-src": { "flake": false, "locked": { diff --git a/flake.nix b/flake.nix index fb6cdfcb..407db59e 100644 --- a/flake.nix +++ b/flake.nix @@ -314,12 +314,6 @@ repo = "sops-nix"; type = "github"; }; - steam-servers = { - inputs.nixpkgs.follows = "nixpkgs"; - owner = "matt1432"; - repo = "nix-steam-servers"; - type = "github"; - }; stylelint-lsp = { inputs.nixpkgs.follows = "nixpkgs"; owner = "matt1432"; diff --git a/inputs.nix b/inputs.nix index bd6338e4..07e9e07e 100644 --- a/inputs.nix +++ b/inputs.nix @@ -89,11 +89,6 @@ let repo = "nixos-minecraft-servers"; }; - steam-servers = mkDep { - owner = "matt1432"; - repo = "nix-steam-servers"; - }; - nix-eval-jobs = mkDep { owner = "nix-community"; repo = "nix-eval-jobs"; diff --git a/lib.nix b/lib.nix index 92bd7e76..b6339d71 100644 --- a/lib.nix +++ b/lib.nix @@ -17,7 +17,6 @@ inputs.grim-hyprland.overlays.default inputs.jovian.overlays.default inputs.nixpkgs-wayland.overlays.default - inputs.steam-servers.inputs.steam-fetcher.overlays.default ]; };