forked from malobeo/infrastructure
[dns] init
This commit is contained in:
@@ -1,27 +1,53 @@
|
||||
{ ... }:
|
||||
|
||||
{
|
||||
#TODO: fix local 192.168.1.0/24 addresses they are just palceholders!
|
||||
malobeo = {
|
||||
hosts = {
|
||||
louise = {
|
||||
type = "host";
|
||||
network = {
|
||||
local = true;
|
||||
address = "192.168.1.11";
|
||||
};
|
||||
};
|
||||
|
||||
bakunin = {
|
||||
type = "host";
|
||||
network = {
|
||||
local = true;
|
||||
address = "192.168.1.12";
|
||||
};
|
||||
};
|
||||
|
||||
fanny = {
|
||||
type = "host";
|
||||
network = {
|
||||
local = true;
|
||||
address = "192.168.1.13";
|
||||
};
|
||||
};
|
||||
|
||||
ns1 = {
|
||||
type = "host";
|
||||
network = {
|
||||
local = true;
|
||||
address = "192.168.1.14";
|
||||
};
|
||||
};
|
||||
|
||||
lucia = {
|
||||
type = "rpi";
|
||||
network = {
|
||||
local = true;
|
||||
address = "192.168.1.15";
|
||||
};
|
||||
};
|
||||
|
||||
durruti = {
|
||||
type = "microvm";
|
||||
network = {
|
||||
local = true;
|
||||
address = "10.0.0.5";
|
||||
mac = "52:DA:0D:F9:EF:F9";
|
||||
};
|
||||
@@ -30,6 +56,7 @@
|
||||
vpn = {
|
||||
type = "microvm";
|
||||
network = {
|
||||
local = true;
|
||||
address = "10.0.0.10";
|
||||
mac = "D0:E5:CA:F0:D7:E6";
|
||||
};
|
||||
@@ -38,6 +65,7 @@
|
||||
infradocs = {
|
||||
type = "microvm";
|
||||
network = {
|
||||
local = true;
|
||||
address = "10.0.0.11";
|
||||
mac = "D0:E5:CA:F0:D7:E7";
|
||||
};
|
||||
@@ -46,6 +74,7 @@
|
||||
uptimekuma = {
|
||||
type = "microvm";
|
||||
network = {
|
||||
local = true;
|
||||
address = "10.0.0.12";
|
||||
mac = "D0:E5:CA:F0:D7:E8";
|
||||
};
|
||||
@@ -54,6 +83,7 @@
|
||||
nextcloud = {
|
||||
type = "microvm";
|
||||
network = {
|
||||
local = true;
|
||||
address = "10.0.0.13";
|
||||
mac = "D0:E5:CA:F0:D7:E9";
|
||||
};
|
||||
@@ -62,6 +92,7 @@
|
||||
overwatch = {
|
||||
type = "microvm";
|
||||
network = {
|
||||
local = true;
|
||||
address = "10.0.0.14";
|
||||
mac = "D0:E5:CA:F0:D7:E0";
|
||||
};
|
||||
@@ -70,14 +101,11 @@
|
||||
zineshop = {
|
||||
type = "microvm";
|
||||
network = {
|
||||
local = true;
|
||||
address = "10.0.0.15";
|
||||
mac = "D0:E5:CA:F0:D7:F1";
|
||||
};
|
||||
};
|
||||
|
||||
testvm = {
|
||||
type = "host";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
39
machines/modules/malobeo/zones.nix
Normal file
39
machines/modules/malobeo/zones.nix
Normal file
@@ -0,0 +1,39 @@
|
||||
{ inputs }:
|
||||
|
||||
let
|
||||
vpnNS = "vpn";
|
||||
localNS = "hq";
|
||||
peers = import ./peers.nix;
|
||||
hosts = ((import ../../hosts.nix ) {}).malobeo.hosts;
|
||||
|
||||
in
|
||||
{
|
||||
SOA = {
|
||||
nameServer = "ns1";
|
||||
adminEmail = "admin@malobeo.org";
|
||||
serial = 2019030800;
|
||||
};
|
||||
useOrigin = false;
|
||||
|
||||
NS = [
|
||||
"ns1.malobeo.org."
|
||||
];
|
||||
|
||||
A = [ "23.23.23.23" ]; #TODO: update
|
||||
AAAA = [ "4321:0:1:2:3:4:567:89ab" ]; #TODO: update
|
||||
|
||||
subdomains = {
|
||||
${localNS} = {
|
||||
subdomains = builtins.mapAttrs (name: value: if value.network.local == true then {
|
||||
A = [ value.network.address ];
|
||||
} else {}) hosts;
|
||||
};
|
||||
|
||||
${vpnNS} = {
|
||||
A = [ peers.vpn.address ];
|
||||
subdomains = builtins.mapAttrs (name: value: if value.role != "server" then {
|
||||
A = [ value.address ];
|
||||
} else {}) peers;
|
||||
};
|
||||
};
|
||||
}
|
||||
34
machines/ns1/configuration.nix
Normal file
34
machines/ns1/configuration.nix
Normal file
@@ -0,0 +1,34 @@
|
||||
{ config, self, lib, inputs, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
with inputs;
|
||||
|
||||
let
|
||||
dns = inputs.dns;
|
||||
in
|
||||
{
|
||||
networking = {
|
||||
hostName = mkDefault "ns1";
|
||||
useDHCP = false;
|
||||
};
|
||||
|
||||
imports = [
|
||||
../modules/malobeo_user.nix
|
||||
../modules/sshd.nix
|
||||
../modules/minimal_tools.nix
|
||||
../modules/autoupdate.nix
|
||||
];
|
||||
|
||||
services.bind = {
|
||||
enable = true;
|
||||
zones = {
|
||||
"malobeo.org" = {
|
||||
master = true;
|
||||
file = pkgs.writeText "zone-malobeo.org" (dns.lib.toString "malobeo.org" (import ../modules/malobeo/zones.nix { inherit inputs; }));
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
system.stateVersion = "22.11"; # Did you read the comment?
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user