nixos-config/lib/fudo/networks.nix

26 lines
725 B
Nix
Raw Normal View History

2021-03-01 14:43:27 -08:00
{ 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 = { };
};
2021-10-19 10:04:35 -07:00
config = let
domain-name = config.instance.local-domain;
local-networks = map (network: "ip4:${network}")
config.fudo.domains.${domain-name}.local-networks;
2021-10-19 12:49:14 -07:00
local-net-string = concatStringsSep " " local-networks;
2021-10-19 10:04:35 -07:00
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"''
];
};
2021-03-01 14:43:27 -08:00
}