Add some modules for game hosting

This commit is contained in:
Charlotte Van Petegem 2020-12-24 00:29:27 +01:00
parent 01be07c830
commit 6134c6e1e6
No known key found for this signature in database
GPG key ID: 019E764B7184435A
7 changed files with 68 additions and 16 deletions

View file

@ -16,7 +16,9 @@
./ssh.nix
./sshd.nix
./syncthing-server.nix
./teeworlds.nix
./tmux.nix
./zeroad.nix
./zfs.nix
./zsh.nix
];

24
modules/teeworlds.nix Normal file
View file

@ -0,0 +1,24 @@
{ config, lib, ... }:
{
options = {
chvp.teeworlds.enable = lib.mkOption {
default = false;
example = true;
};
};
config = lib.mkIf config.chvp.teeworlds.enable {
services.teeworlds = {
enable = true;
openPorts = true;
extraOptions = [
"sv_gametype ctf"
"sv_maprotation ctf1 ctf2 ctf3 ctf4 ctf5 ctf6 ctf7 ctf8"
"sv_map ctf1"
"sv_scorelimit 250"
"sv_teamdamage 1"
];
};
};
}

36
modules/zeroad.nix Normal file
View file

@ -0,0 +1,36 @@
{ config, lib, pkgs, ... }:
{
options = {
chvp.zeroad = {
enable = lib.mkOption {
default = false;
example = true;
};
asServer = lib.mkOption {
default = false;
example = true;
};
};
};
config = lib.mkIf config.chvp.zeroad.enable {
chvp.zfs.homeLinks = [
{ path = ".config/0ad"; type = "cache"; }
];
nixpkgs.config.permittedInsecurePackages = [
"spidermonkey-38.8.0"
];
hardware.opengl.enable = true;
home-manager.users.charlotte = { pkgs, ... }: {
home.packages = [ pkgs.zeroad ];
};
networking.firewall = lib.mkIf config.chvp.zeroad.asServer {
allowedTCPPorts = [ 20595 ];
allowedUDPPorts = [ 20595 ];
};
services.openssh.forwardX11 = lib.mkDefault config.chvp.zeroad.asServer;
};
}