1
0
Fork 0
mirror of https://github.com/mdlayher/homelab.git synced 2024-12-14 11:47:32 +00:00

nixos: refactor vars.hosts, generate CoreDNS host records

This commit is contained in:
Matt Layher 2020-01-24 10:34:36 -05:00
parent 7b27006399
commit 308f2a22bf
4 changed files with 19 additions and 18 deletions

View file

@ -1,4 +1,4 @@
{ config, ... }:
{ config, lib, ... }:
let
vars = import ./vars.nix;
@ -58,14 +58,12 @@ in {
${lan0.ipv4} routnerr-2.${domain}
${lan0.ipv6.ula} routnerr-2.${domain}
${vars.hosts.monitnerr-1.ipv4} monitnerr-1.${domain}
${vars.hosts.monitnerr-1.ipv6.ula} monitnerr-1.${domain}
${vars.hosts.nerr-3.ipv4} nerr-3.${domain}
${vars.hosts.nerr-3.ipv6.ula} nerr-3.${domain}
${vars.hosts.servnerr-3.ipv4} servnerr-3.${domain}
${vars.hosts.servnerr-3.ipv6.ula} servnerr-3.${domain}
${
lib.concatMapStrings (host: ''
${host.ipv4} ${host.name}.${domain}
${host.ipv6.ula} ${host.name}.${domain}
'') [ vars.hosts.desktop vars.hosts.monitor vars.hosts.server ]
}
192.168.1.2 switch-livingroom01.${domain}
192.168.1.3 switch-office01.${domain}

View file

@ -17,17 +17,17 @@ in {
{
hostName = "monitnerr-1";
ethernetAddress = "dc:a6:32:1e:66:94";
ipAddress = "${vars.hosts.monitnerr-1.ipv4}";
ipAddress = "${vars.hosts.monitor.ipv4}";
}
{
hostName = "nerr-3";
ethernetAddress = "04:d9:f5:7e:1c:47";
ipAddress = "${vars.hosts.nerr-3.ipv4}";
ipAddress = "${vars.hosts.desktop.ipv4}";
}
{
hostName = "servnerr-3";
ethernetAddress = "06:cb:90:4d:a2:59";
ipAddress = "${vars.hosts.servnerr-3.ipv4}";
ipAddress = "${vars.hosts.server.ipv4}";
}
{
hostName = "switch-livingroom01";

View file

@ -10,9 +10,9 @@ let
wan0 = vars.interfaces.wan0;
wg0 = vars.interfaces.wg0;
desktop = vars.hosts.nerr-3;
monitor = vars.hosts.monitnerr-1;
server = vars.hosts.servnerr-3;
desktop = vars.hosts.desktop;
monitor = vars.hosts.monitor;
server = vars.hosts.server;
ports = {
dns = "53";

View file

@ -2,21 +2,24 @@
cfg = "/home/matt/cfg";
domain = "lan.servnerr.com";
hosts = {
monitnerr-1 = {
monitor = {
name = "monitnerr-1";
ipv4 = "192.168.1.11";
ipv6 = {
gua = "2600:6c4a:787f:d100:dea6:32ff:fe1e:6694";
ula = "fd9e:1a04:f01d:0:dea6:32ff:fe1e:6694";
};
};
nerr-3 = {
desktop = {
name = "nerr-3";
ipv4 = "192.168.1.9";
ipv6 = {
gua = "2600:6c4a:787f:d100:6d9:f5ff:fe7e:1c47";
ula = "fd9e:1a04:f01d:0:6d9:f5ff:fe7e:1c47";
};
};
servnerr-3 = {
server = {
name = "servnerr-3";
ipv4 = "192.168.1.4";
ipv6 = {
gua = "2600:6c4a:787f:d100:4cb:90ff:fe4d:a259";