214 lines
6 KiB
Nix
214 lines
6 KiB
Nix
let
|
|
era = { ethernetAddress = "28:80:23:00:2f:45";
|
|
hostName = "era";
|
|
ipAddress = "10.42.0.254"; };
|
|
eddieValiant = { ethernetAddress = "00:23:ae:89:04:60";
|
|
hostName = "eddieValiant";
|
|
ipAddress = "10.42.0.1"; };
|
|
rogerRabbit = { ethernetAddress = "00:23:ae:82:82:7a";
|
|
hostName = "rogerRabbit";
|
|
ipAddress = "10.42.0.2"; };
|
|
jessicaRabbit = { ethernetAddress = "00:23:ae:88:fb:b9";
|
|
hostName = "jessicaRabbit";
|
|
ipAddress = "10.42.0.3"; };
|
|
bongo = { ethernetAddress = "00:21:9b:2f:1f:99";
|
|
hostName = "bongo";
|
|
ipAddress = "10.42.0.4"; };
|
|
shareDir = "/var/public";
|
|
common =
|
|
{
|
|
boot.loader.grub.devices = [ "/dev/sda" ];
|
|
|
|
i18n = {
|
|
consoleFont = "Lat2-Terminus16";
|
|
consoleKeyMap = "fr-bepo";
|
|
defaultLocale = "en_US.UTF-8";
|
|
};
|
|
|
|
services = {
|
|
openssh = {
|
|
enable = true;
|
|
permitRootLogin = "yes";
|
|
};
|
|
};
|
|
networking.firewall.enable = false;
|
|
|
|
users.mutableUsers = false;
|
|
security.initialRootPassword = "$6$hoiRRInkFqRV$WmQzqHPTRqaptmXPqNKfIBmiyyckmHKksVJZd94WQ0HHNx5wnGWL76H8.pN.gQ.9Mf.JaVL6oSAw4MjMoTcSF1";
|
|
|
|
};
|
|
in
|
|
{
|
|
network.description = "DJL machines";
|
|
|
|
# TF2 server
|
|
rogerRabbit = { config, pkgs, lib, ... }:
|
|
lib.recursiveUpdate common {
|
|
imports = [ ./rogerRabbit-hw.nix ];
|
|
|
|
environment.systemPackages = with pkgs; [
|
|
steam-run
|
|
];
|
|
|
|
users.extraUsers.tf2 = {
|
|
createHome = true;
|
|
isNormalUser = true;
|
|
};
|
|
|
|
systemd.services = with pkgs; {
|
|
tf2ds = {
|
|
description = "Dedicated server for Team Fortress 2";
|
|
wants = [ "network.target" ];
|
|
after = [ "network.target" ];
|
|
script = ''
|
|
cd tf2ds
|
|
${steam-run}/bin/steam-run ./srcds_run -console -game tf -nohltv +randommap +sv_pure 1 +map ctf_2fort +maxplayers 32
|
|
'';
|
|
wantedBy = [ "multi-user.target" ];
|
|
serviceConfig = {
|
|
User = "tf2";
|
|
Type = "simple";
|
|
Restart = "always";
|
|
RestartSec = 5;
|
|
WorkingDirectory = "~";
|
|
};
|
|
};
|
|
};
|
|
|
|
nixpkgs.config.allowUnfree = true;
|
|
};
|
|
|
|
# Urban Terror server
|
|
# http://openarena.wikia.com/wiki/Dedicated_server#Dedicated_server
|
|
jessicaRabbit = { config, pkgs, lib, ... }:
|
|
lib.recursiveUpdate common {
|
|
imports = [ ./jessicaRabbit-hw.nix ];
|
|
|
|
environment.systemPackages = with pkgs; [
|
|
xonotic
|
|
hedgewars
|
|
];
|
|
nixpkgs.config.allowUnfree = true;
|
|
|
|
users.extraUsers.xonotic = {
|
|
createHome = true;
|
|
isNormalUser = true;
|
|
};
|
|
users.extraUsers.hedgewars = {
|
|
createHome = true;
|
|
isNormalUser = true;
|
|
};
|
|
systemd.services = with pkgs; {
|
|
xonoticds = {
|
|
description = "Dedicated server for xonotic";
|
|
wants = [ "network.target" ];
|
|
after = [ "network.target" ];
|
|
script = ''
|
|
${xonotic}/bin/xonotic-dedicated
|
|
'';
|
|
wantedBy = [ "multi-user.target" ];
|
|
serviceConfig = {
|
|
User = "xonotic";
|
|
Type = "simple";
|
|
Restart = "always";
|
|
RestartSec = 5;
|
|
WorkingDirectory = "~";
|
|
};
|
|
};
|
|
hedgewarsds = {
|
|
description = "Dedicated server for hedgewars";
|
|
wants = [ "network.target" ];
|
|
after = [ "network.target" ];
|
|
script = ''
|
|
${hedgewars}/bin/hedgewars-server -d True
|
|
'';
|
|
wantedBy = [ "multi-user.target" ];
|
|
serviceConfig = {
|
|
User = "hedgewars";
|
|
Type = "simple";
|
|
Restart = "always";
|
|
RestartSec = 5;
|
|
WorkingDirectory = "~";
|
|
};
|
|
};
|
|
};
|
|
};
|
|
|
|
# file server
|
|
bongo = { config, pkgs, lib, ... }:
|
|
lib.recursiveUpdate common {
|
|
imports = [ ./bongo-hw.nix ];
|
|
|
|
system.activationScripts = {
|
|
share = {
|
|
text = ''
|
|
mkdir -p ${shareDir}
|
|
chmod -R +r ${shareDir}
|
|
'';
|
|
deps = [];
|
|
};
|
|
};
|
|
|
|
services.samba = {
|
|
enable = true;
|
|
shares.public = {
|
|
browseable = "yes";
|
|
comment = "Partage de fichiers demi-journée ludique";
|
|
"guest ok" = "yes";
|
|
path = shareDir;
|
|
"read only" = true;
|
|
};
|
|
};
|
|
services.nginx = {
|
|
enable = true;
|
|
recommendedOptimisation = true;
|
|
recommendedTlsSettings = true;
|
|
recommendedGzipSettings = true;
|
|
recommendedProxySettings = true;
|
|
virtualHosts = {
|
|
"${bongo.ipAddress}" = {
|
|
locations."/" = {
|
|
root = shareDir;
|
|
index = "index.html index.htm";
|
|
extraConfig = ''
|
|
autoindex on;
|
|
'';
|
|
};
|
|
};
|
|
};
|
|
};
|
|
|
|
};
|
|
|
|
# DHCP/DNS server
|
|
eddieValiant = { config, pkgs, lib, ... }:
|
|
lib.recursiveUpdate common {
|
|
imports = [ ./eddieValiant-hw.nix ];
|
|
|
|
services = {
|
|
dhcpd4 = {
|
|
enable = true;
|
|
interfaces = [ "enp2s0" ];
|
|
machines = [ era rogerRabbit jessicaRabbit bongo ];
|
|
extraConfig = ''
|
|
subnet 10.42.0.0 netmask 255.255.0.0 {
|
|
authoritative;
|
|
range 10.42.0.50 10.42.0.200;
|
|
default-lease-time 3600;
|
|
max-lease-time 3600;
|
|
option subnet-mask 255.255.0.0;
|
|
option broadcast-address 10.42.255.255;
|
|
option routers 10.42.0.0;
|
|
#option domain-name-servers 10.42.0.1;
|
|
#option domain-name "djl.local";
|
|
}
|
|
'';
|
|
};
|
|
};
|
|
networking = {
|
|
dhcpcd.enable = false;
|
|
interfaces."enp2s0".ipAddress = eddieValiant.ipAddress;
|
|
interfaces."enp2s0".prefixLength = 16;
|
|
};
|
|
};
|
|
}
|