@cryptotaxi247 / infra-1 / commits / 81a49fa6

* Use dnsmasq instead of dhcpd. This should be turned into a NixOS module.

* Use dnsmasq instead of dhcpd. This should be turned into a NixOS module. svn path=/configurations/trunk/tud/; revision=24227

Eelco Dolstra committed Oct 11, 2010 at 20:48 UTC 81a49fa646ef366f0ac6165d0d39566f3cbd9be6
2 files changed +24 -27
cartman.nix
+24 -23
@@ -73,11 +73,9 @@ rec {
73
74 defaultGateway = "130.161.158.1";
75
76 - nameservers = ["130.161.158.4" "130.161.33.17" "130.161.180.1"];
76 + nameservers = [ "127.0.0.1" ];
77
78 - extraHosts =
79 - let toHosts = m: "${m.ipAddress} ${m.hostName} ${concatStringsSep " " (if m ? aliases then m.aliases else [])}\n"; in
80 - concatStrings (map toHosts machines);
78 + extraHosts = "192.168.1.5 cartman";
79
80 localCommands =
81 # Provide NATting for the build machines on 192.168.1.*.
@@ -117,25 +115,6 @@ rec {
115 ];
116 };
117
120 - dhcpd = {
121 - enable = true;
122 - interfaces = ["eth0"];
123 - extraConfig = ''
124 - option subnet-mask 255.255.255.0;
125 - option broadcast-address 192.168.1.255;
126 - option routers 192.168.1.5;
127 - option domain-name-servers 130.161.158.4, 130.161.33.17, 130.161.180.1;
128 - option domain-name "buildfarm-net";
129 -
130 - subnet 192.168.1.0 netmask 255.255.255.0 {
131 - range 192.168.1.100 192.168.1.200;
132 - }
133 -
134 - use-host-decl-names on;
135 - '';
136 - machines = filter (machine: machine ? ethernetAddress) machines;
137 - };
138 -
118 postgresql = {
119 enable = true;
120 enableTCPIP = true;
@@ -462,4 +441,26 @@ rec {
441 # Needed for the Nixpkgs mirror script.
442 environment.pathsToLink = [ "/libexec" ];
443
444 + jobs.dnsmasq =
445 + let confFile = pkgs.writeText "dnsmasq.conf"
446 + ''
447 + keep-in-foreground
448 + expand-hosts
449 + domain=buildfarm
450 +
451 + server=130.161.158.4
452 + server=130.161.33.17
453 + server=130.161.180.1
454 +
455 + dhcp-range=192.168.1.100,192.168.1.200
456 +
457 + ${flip concatMapStrings machines (m: optionalString (m ? ethernetAddress) ''
458 + dhcp-host=${m.ethernetAddress},${m.ipAddress},${m.hostName}
459 + '')}
460 + '';
461 + in
462 + { startOn = "network-interfaces";
463 + exec = "${pkgs.dnsmasq}/bin/dnsmasq --conf-file=${confFile}";
464 + };
465 +
466 }
hydra.nix
-4
@@ -63,10 +63,6 @@ in
63 networking = {
64 hostName = "hydra";
65 domain = "buildfarm";
66 -
67 - extraHosts =
68 - let toHosts = m: "${m.ipAddress} ${m.hostName} ${pkgs.lib.concatStringsSep " " (if m ? aliases then m.aliases else [])}\n"; in
69 - pkgs.lib.concatStrings (map toHosts machines);
66 };
67
68 services.cron.systemCronJobs =