networks -> zones
This commit is contained in:
parent
c204541f38
commit
70ba6a4474
|
@ -28,7 +28,6 @@ with lib; {
|
|||
./mail-container.nix
|
||||
./minecraft-server.nix
|
||||
./netinfo-email.nix
|
||||
./networks.nix
|
||||
./node-exporter.nix
|
||||
./nsd.nix
|
||||
./password.nix
|
||||
|
@ -45,5 +44,6 @@ with lib; {
|
|||
./vpn.nix
|
||||
./webmail.nix
|
||||
./wireless-networks.nix
|
||||
./zones.nix
|
||||
];
|
||||
}
|
||||
|
|
|
@ -1,25 +0,0 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
with types;
|
||||
let networkOpts = import ../types/network-definition.nix { inherit lib; };
|
||||
|
||||
in {
|
||||
options.fudo.networks = mkOption {
|
||||
type = attrsOf (submodule networkOpts);
|
||||
description = "A map of networks to network definitions.";
|
||||
default = { };
|
||||
};
|
||||
|
||||
config = let
|
||||
domain-name = config.instance.local-domain;
|
||||
local-networks = map (network: "ip4:${network}")
|
||||
config.fudo.domains.${domain-name}.local-networks;
|
||||
local-net-string = concatStringsSep " " local-networks;
|
||||
in {
|
||||
fudo.networks.${domain-name}.verbatim-dns-records = [
|
||||
''@ IN TXT "v=spf1 mx ${local-net-string} -all"''
|
||||
''@ IN SPF "v=spf1 mx ${local-net-string} -all"''
|
||||
];
|
||||
};
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
let
|
||||
zoneOpts =
|
||||
import ../types/network-definition.nix { inherit lib; };
|
||||
in {
|
||||
options.fudo.zones = with types; mkOption {
|
||||
type = attrsOf (submodule zoneOpts);
|
||||
description = "A map of network zone to zone definition.";
|
||||
default = { };
|
||||
};
|
||||
|
||||
config = let
|
||||
domain-name = config.instance.local-domain;
|
||||
# FIXME: ipv6?
|
||||
local-networks = config.instance.local-networks;
|
||||
net-names = map (network: "ipv4:${network}")
|
||||
local-networks;
|
||||
local-net-string = concatStringsSep " " net-names;
|
||||
in {
|
||||
fudo.zones.${domain-name}.verbatim-dns-records = [
|
||||
''@ IN TXT "v=spf1 mx ${local-net-string} -all"''
|
||||
''@ IN SPF "v=spf1 mx ${local-net-string} -all"''
|
||||
];
|
||||
};
|
||||
}
|
Loading…
Reference in New Issue