Few tweaks

This commit is contained in:
Martin Potier 2017-06-20 10:37:34 +02:00
parent 545d36ecab
commit 7de1686f36

View file

@ -1,4 +1,21 @@
let common =
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 = "/srv/public";
common =
{
boot.loader.grub.devices = [ "/dev/sda" ];
@ -14,7 +31,8 @@ let common =
permitRootLogin = "yes";
};
};
networking.firewall.allowedTCPPorts = [ 22 ];
#networking.firewall.allowedTCPPorts = [ 22 ];
networking.firewall.enable = false;
users.mutableUsers = false;
security.initialRootPassword = "$6$hoiRRInkFqRV$WmQzqHPTRqaptmXPqNKfIBmiyyckmHKksVJZd94WQ0HHNx5wnGWL76H8.pN.gQ.9Mf.JaVL6oSAw4MjMoTcSF1";
@ -36,15 +54,69 @@ in
};
# 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; [
zeroad
widelands
xonotic
xpilot-ng
armagetronad
hedgewars
openclonk
];
nixpkgs.config.allowUnfree = true;
};
# 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;
'';
};
};
};
};
networking.firewall.allowedTCPPorts = [ 139 445 80 443 ];
networking.firewall.allowedUDPPorts = [ 137 138 ];
};
# DHCP/DNS server
@ -56,20 +128,7 @@ in
dhcpd4 = {
enable = true;
interfaces = [ "enp2s0" ];
machines = [
{ ethernetAddress = "28:80:23:00:2f:45";
hostName = "era";
ipAddress = "10.42.0.254"; }
{ ethernetAddress = "00:23:ae:82:82:7a";
hostName = "rogerRabbit";
ipAddress = "10.42.0.2"; }
{ ethernetAddress = "00:23:ae:88:fb:b9";
hostName = "jessicaRabbit";
ipAddress = "10.42.0.3"; }
{ ethernetAddress = "00:21:9b:2f:1f:99";
hostName = "bongo";
ipAddress = "10.42.0.4"; }
];
machines = [ era rogerRabbit jessicaRabbit bongo ];
extraConfig = ''
subnet 10.42.0.0 netmask 255.255.0.0 {
authoritative;
@ -87,7 +146,7 @@ in
};
networking = {
dhcpcd.enable = false;
interfaces."enp2s0".ipAddress = "10.42.0.1";
interfaces."enp2s0".ipAddress = eddieValiant.ipAddress;
interfaces."enp2s0".prefixLength = 16;
};
};