refactor flake
This commit is contained in:
parent
df8b91d5f8
commit
7efa62f47d
7 changed files with 75 additions and 69 deletions
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
hades = import ./hades;
|
||||
olympus = import ./olympus;
|
||||
thalassa = import ./thalassa;
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
ip = "10.42.42.4";
|
||||
ip6 = "2001:41f0:9639:1:80f0:7cff:fecb:bd6d";
|
||||
mac = "82:F0:7C:CB:BD:6D";
|
||||
lxc = false;
|
||||
type = "vm";
|
||||
}
|
||||
{
|
||||
hostname = "vault";
|
||||
|
@ -53,7 +53,7 @@
|
|||
profile = "k3s";
|
||||
ip = "10.42.42.10";
|
||||
mac = "2E:F8:55:23:D9:9B";
|
||||
lxc = false;
|
||||
type = "vm";
|
||||
}
|
||||
{
|
||||
hostname = "WoolooTV";
|
||||
|
|
|
@ -6,7 +6,7 @@ let
|
|||
ipAddress = ip;
|
||||
};
|
||||
localDomain = config.networking.domain;
|
||||
hosts' = hosts.${localDomain};
|
||||
hosts' = builtins.filter (builtins.hasAttr "ip") hosts.${localDomain};
|
||||
in {
|
||||
imports = [ ];
|
||||
|
||||
|
|
|
@ -1,15 +1,14 @@
|
|||
{ config, pkgs, hosts, flat_hosts, ... }:
|
||||
let
|
||||
inherit (builtins) filter hasAttr attrNames;
|
||||
hosts' = flat_hosts;
|
||||
domains = attrNames hosts;
|
||||
ipv4Host = filter (hasAttr "ip") flat_hosts;
|
||||
ipv6Hosts = filter (hasAttr "ip6") flat_hosts;
|
||||
|
||||
ipv6Hosts = filter (hasAttr "ip6") hosts';
|
||||
|
||||
localData = { hostname, location, ip, ... }: ''"${hostname}.${location}. A ${ip}"'';
|
||||
local6Data = { hostname, location, ip6, ... }: ''"${hostname}.${location}. AAAA ${ip6}"'';
|
||||
ptrData = { hostname, location, ip, ... }: ''"${ip} ${hostname}.${location}"'';
|
||||
ptr6Data = { hostname, location, ip6, ... }: ''"${ip6} ${hostname}.${location}"'';
|
||||
localData = { hostname, realm, ip, ... }: ''"${hostname}.${realm}. A ${ip}"'';
|
||||
local6Data = { hostname, realm, ip6, ... }: ''"${hostname}.${realm}. AAAA ${ip6}"'';
|
||||
ptrData = { hostname, realm, ip, ... }: ''"${ip} ${hostname}.${realm}"'';
|
||||
ptr6Data = { hostname, realm, ip6, ... }: ''"${ip6} ${hostname}.${realm}"'';
|
||||
in {
|
||||
imports = [ ];
|
||||
|
||||
|
@ -38,8 +37,8 @@ in {
|
|||
interface = [ "0.0.0.0" "::0" ];
|
||||
|
||||
local-zone = map (localdomain: ''"${localdomain}}." transparent'') domains;
|
||||
local-data = (map localData hosts') ++ (map local6Data ipv6Hosts);
|
||||
local-data-ptr = (map ptrData hosts') ++ (map ptr6Data ipv6Hosts);
|
||||
local-data = (map localData ipv4Host) ++ (map local6Data ipv6Hosts);
|
||||
local-data-ptr = (map ptrData ipv4Host) ++ (map ptr6Data ipv6Hosts);
|
||||
|
||||
access-control = [
|
||||
"127.0.0.1/32 allow_snoop"
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
[
|
||||
{
|
||||
hostname = "null";
|
||||
mac = "";
|
||||
type = "local";
|
||||
}
|
||||
]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue