Initial flake commit
This commit is contained in:
@@ -43,6 +43,8 @@ with lib; {
|
||||
./fudo/webmail.nix
|
||||
./fudo/wireless-networks.nix
|
||||
|
||||
./fudo/games/valheim.nix
|
||||
|
||||
./informis/cl-gemini.nix
|
||||
];
|
||||
}
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
{ ... }:
|
||||
|
||||
{
|
||||
imports = [ ./valheim.nix ];
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
let cfg = config.fudo.games.valheim;
|
||||
in {
|
||||
options.fudo.games.valheim = with types; {
|
||||
enable = mkEnableOption "Enable dedicated Valheim server.";
|
||||
|
||||
state-directory = mkOption {
|
||||
type = str;
|
||||
description = "Directory at which to store Valheim state data.";
|
||||
default = "/var/lib/valheim";
|
||||
};
|
||||
|
||||
port = mkOption {
|
||||
type = port;
|
||||
description = "Port on which to listen for connections.";
|
||||
default = 2456;
|
||||
};
|
||||
|
||||
password = mkOption {
|
||||
type = str;
|
||||
description = "Password required by connecting users.";
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
users.users.valheim = {
|
||||
home = cfg.state-directory;
|
||||
createHome = true;
|
||||
isSystemUser = true;
|
||||
};
|
||||
|
||||
systemd.services.fudo-valheim = {
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
serviceConfig = {
|
||||
ExecStartPre = ''
|
||||
[[ -d ${cfg.state-directory}/state ]] || mkdir ${cfg.state-directory}/state
|
||||
${pkgs.steamcmd}/bin/steamcmd \
|
||||
+login anonymous \
|
||||
+force_install_dir ${cfg.state-directory}/state \
|
||||
+app_update 896660 \
|
||||
+quit
|
||||
'';
|
||||
|
||||
ExecStart = ''
|
||||
${pkgs.glibc}/lib/ld-linux-x86-64.so.2 ./valheim_server.x86_64 \
|
||||
-name "CoCo Valheim" \
|
||||
-port ${toString cfg.port} \
|
||||
-world "Dedicated" \
|
||||
-password ${cfg.password} \
|
||||
-public 1
|
||||
'';
|
||||
Nice = -5;
|
||||
Restart = "always";
|
||||
User = "valheim";
|
||||
StateDirectory = "${cfg.state-directory}/state";
|
||||
WorkingDirectory = cfg.state-directory;
|
||||
};
|
||||
environment = { LD_LIBRARY_PATH = "linux64:${pkgs.glibc}/lib"; };
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user