Setting SOA records using `subDomains` is broken
Simple setup with defining SOA using `subDomains` (instead of `extraConfig` as in example) don't builds zone files:
```nix
(
let
rootZone = "example.org";
in
{
networking.domains = {
enable = true;
defaultTTL = 86400; # 24h
baseDomains."nodes.${rootZone}" = { };
baseDomains."${rootZone}" = { };
subDomains."${rootZone}".soa.data = {
mname = "a.misconfigured.dns.server.invalid";
rname = "hostmaster\.${rootZone}";
serial = 0;
refresh = 10800;
retry = 3600;
expire = 604800;
};
};
}
)
```
```
at /nix/store/d4vvgffq1k76dri89sji04qc69ybjqkd-source/utils/zonefiles.nix:79:25:
78| lib.mapAttrsToList (
79| recordType: record:
| ^
80| (builtins.map (
error: value is a set while a list was expected
```
Wherein it's impossible to pass list in `soa.data`, because it is null or submodule.
Full example to reproduce:
`nix build ".#dns.zoneFiles" -v --show-trace`
```nix
{
description = "A example on how one can use nixos-dns";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
nixos-dns.url = "github:Janik-Haag/nixos-dns";
nixos-dns.inputs.nixpkgs.follows = "nixpkgs";
};
outputs =
inputs@{ self, nixpkgs, nixos-dns, }:
let
forAllSystems = nixpkgs.lib.genAttrs [
"x86_64-linux"
"aarch64-linux"
];
dnsConfig = {
inherit (self) nixosConfigurations;
};
in
{
nixosConfigurations = {
host1 = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
nixos-dns.nixosModules.dns
(
let
rootZone = "example.org";
in
{
networking.domains = {
enable = true;
defaultTTL = 86400; # 24h
baseDomains."nodes.${rootZone}" = { };
baseDomains."${rootZone}" = { };
subDomains."${rootZone}".soa.data = {
mname = "a.misconfigured.dns.server.invalid";
rname = "hostmaster\.${rootZone}";
serial = 0;
refresh = 10800;
retry = 3600;
expire = 604800;
};
};
}
)
];
};
};
# nix eval .#dnsDebugConfig
dnsDebugConfig = nixos-dns.utils.debug.config dnsConfig;
packages = forAllSystems (
system:
let
generate = nixos-dns.utils.generate nixpkgs.legacyPackages.${system};
in
{
# nix build .#zoneFiles
dns.zoneFiles = generate.zoneFiles dnsConfig;
}
);
};
}
```
2 条评论