mirror of
https://git.sr.ht/~magic_rb/dotfiles
synced 2024-11-30 12:06:13 +01:00
e0ec4be761
Signed-off-by: magic_rb <magic_rb@redalder.org>
114 lines
3 KiB
Nix
114 lines
3 KiB
Nix
{
|
|
inputs',
|
|
pkgs,
|
|
...
|
|
}: {
|
|
ucontainers."arma3" = {
|
|
network = [
|
|
{
|
|
hostAddress = "10.99.99.1/24";
|
|
guestAddress = "10.99.99.2/24";
|
|
hostInterface = "arma3";
|
|
guestInterface = "eth0";
|
|
}
|
|
];
|
|
settings = {
|
|
ephemeral = true;
|
|
bind = [
|
|
"/etc/resolv.conf"
|
|
"/var/lib/arma3/steam:/home/steam/Steam"
|
|
"/var/lib/arma3/Steam:/home/steam/.local/share/Steam"
|
|
"/var/lib/arma3/steamapps:/var/lib/steam"
|
|
"/tmp/arma-secret/:/secret"
|
|
];
|
|
};
|
|
path =
|
|
(inputs'.nixng.nglib.makeSystem {
|
|
inherit (pkgs.stdenv) system;
|
|
inherit (inputs') nixpkgs;
|
|
name = "arma3";
|
|
|
|
config = let
|
|
inherit
|
|
(pkgs.lib)
|
|
getExe
|
|
getExe'
|
|
;
|
|
in {
|
|
dumb-init = {
|
|
enable = true;
|
|
type.services = {};
|
|
};
|
|
|
|
nixpkgs.pkgs = pkgs;
|
|
|
|
init.services.network = {
|
|
enabled = true;
|
|
script = pkgs.writeShellScript "network-start" ''
|
|
ip addr add "10.99.99.2/24" dev "eth0"
|
|
ip link set "eth0" up
|
|
ip route add "10.99.99.0/24" dev "eth0"
|
|
ip route add default via "10.99.99.1" dev "eth0"
|
|
|
|
touch /etc/hosts
|
|
|
|
exec sleep infinity
|
|
'';
|
|
};
|
|
|
|
users.users."steam" = {
|
|
uid = 1001;
|
|
home = "/home/steam";
|
|
group = "steam";
|
|
};
|
|
|
|
users.groups."steam" = {
|
|
gid = 1001;
|
|
};
|
|
|
|
init.services.steam-login = {
|
|
enabled = true;
|
|
script = pkgs.writeShellScript "steam-login-start" ''
|
|
mkdir -p /home/steam
|
|
chown steam:steam -R /home/steam
|
|
chown steam:steam -R /var/lib/steam
|
|
HOME=/home/steam USER=steam chpst -U steam:steam -u steam:steam ${getExe pkgs.steamcmd} \
|
|
+force_install_dir /var/lib/steam \
|
|
+login "$(cat /secret/user)" "$(cat /secret/password)" \
|
|
+app_update 233780 validate \
|
|
+quit
|
|
|
|
exec sleep infinity
|
|
'';
|
|
};
|
|
|
|
init.services.arma3 = {
|
|
dependencies = [
|
|
"steam-login"
|
|
];
|
|
enabled = true;
|
|
script = pkgs.writeShellScript "arma3-start" ''
|
|
sleep 15
|
|
cd /var/lib/steam
|
|
PATH=${pkgs.coreutils}/bin:$PATH LD_LIBRARY_PATH=${pkgs.stdenv.cc.cc.lib}/lib:$PWD exec \
|
|
chpst -u steam:steam \
|
|
${getExe' pkgs.glibc "ld.so"} ./arma3server_x64 \
|
|
-config=./server.cfg \
|
|
-mod=./mods/@ACE \
|
|
-mod=./mods/@Antistasi \
|
|
-mod=./mods/@CBA_A3 \
|
|
-mod=./mods/@RHSAFRF \
|
|
-mod=./mods/@RHSGREF \
|
|
-mod=./mods/@RHSSAF \
|
|
-mod=./mods/@RHSUSAF
|
|
'';
|
|
};
|
|
};
|
|
})
|
|
.config
|
|
.system
|
|
.build
|
|
.toplevel;
|
|
};
|
|
}
|