stockholm/lass/2configs/games.nix

94 lines
2.2 KiB
Nix
Raw Normal View History

2015-07-16 13:51:01 +00:00
{ config, pkgs, ... }:
let
mainUser = config.users.extraUsers.mainUser;
2016-12-07 09:14:27 +00:00
vdoom = pkgs.writeDash "vdoom" ''
2018-04-06 13:57:20 +00:00
${pkgs.zandronum}/bin/zandronum \
2016-12-07 09:14:27 +00:00
-fov 120 \
"$@"
'';
2016-12-01 16:10:31 +00:00
doom = pkgs.writeDash "doom" ''
DOOM_DIR=''${DOOM_DIR:-~/doom/}
2016-12-07 09:14:27 +00:00
${vdoom} \
2016-12-01 16:10:31 +00:00
-file $DOOM_DIR/lib/brutalv20.pk3 \
"$@"
'';
doom1 = pkgs.writeDashBin "doom1" ''
DOOM_DIR=''${DOOM_DIR:-~/doom/}
${doom} -iwad $DOOM_DIR/wads/stock/doom.wad "$@"
'';
doom2 = pkgs.writeDashBin "doom2" ''
DOOM_DIR=''${DOOM_DIR:-~/doom/}
${doom} -iwad $DOOM_DIR/wads/stock/doom2.wad "$@"
'';
2016-12-07 09:14:27 +00:00
vdoom1 = pkgs.writeDashBin "vdoom1" ''
DOOM_DIR=''${DOOM_DIR:-~/doom/}
${vdoom} -iwad $DOOM_DIR/wads/stock/doom.wad "$@"
'';
vdoom2 = pkgs.writeDashBin "vdoom2" ''
DOOM_DIR=''${DOOM_DIR:-~/doom/}
${vdoom} -iwad $DOOM_DIR/wads/stock/doom2.wad "$@"
'';
2015-07-16 13:51:01 +00:00
2017-02-22 17:21:30 +00:00
doomservercfg = pkgs.writeText "doomserver.cfg" ''
skill 7
#survival true
#sv_maxlives 4
#sv_norespawn true
#sv_weapondrop true
no_jump true
#sv_noweaponspawn true
sv_sharekeys true
sv_survivalcountdowntime 1
sv_noteamselect true
sv_updatemaster false
#sv_coop_loseinventory true
#cl_startasspectator false
#lms_spectatorview false
'';
vdoomserver = pkgs.writeDashBin "vdoomserver" ''
DOOM_DIR=''${DOOM_DIR:-~/doom/}
2018-04-06 13:57:20 +00:00
${pkgs.zandronum}/bin/zandronum-server \
2017-02-22 17:21:30 +00:00
+exec ${doomservercfg} \
"$@"
'';
2015-07-16 13:51:01 +00:00
in {
environment.systemPackages = with pkgs; [
2017-12-13 17:29:40 +00:00
(dwarf-fortress.override { theme = dwarf-fortress-packages.phoebus-theme; })
2016-12-01 16:10:31 +00:00
doom1
doom2
2016-12-07 09:14:27 +00:00
vdoom1
vdoom2
2017-02-22 17:21:30 +00:00
vdoomserver
2015-07-16 13:51:01 +00:00
];
users.extraUsers = {
games = {
name = "games";
description = "user playing games";
home = "/home/games";
2016-04-09 12:16:47 +00:00
extraGroups = [ "audio" "video" "input" "loot" ];
2015-07-16 13:51:01 +00:00
createHome = true;
useDefaultShell = true;
2018-01-30 18:05:10 +00:00
packages = with pkgs; [
ftb
minecraft
];
2015-07-16 13:51:01 +00:00
};
};
hardware.pulseaudio.support32Bit = true;
2015-07-16 13:51:01 +00:00
security.sudo.extraConfig = ''
${mainUser.name} ALL=(games) NOPASSWD: ALL
'';
2017-02-22 17:22:06 +00:00
krebs.iptables.tables.filter.INPUT.rules = [
{ predicate = "-p tcp --dport 10666"; target = "ACCEPT"; }
2017-02-23 15:32:46 +00:00
{ predicate = "-p udp --dport 10666"; target = "ACCEPT"; }
2017-02-22 17:22:06 +00:00
];
2015-07-16 13:51:01 +00:00
}