Skip to content

Commit 65bc040

Browse files
committed
nixos/hickory-dns: combine Hint and Forward zone types into one
In 0.25.0-alpha.5 the Hint and Forward zone types where combined into External
1 parent 36fd87b commit 65bc040

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

nixos/modules/services/networking/hickory-dns.nix

+7-8
Original file line numberDiff line numberDiff line change
@@ -13,28 +13,27 @@ let
1313
'';
1414
};
1515
zone_type = mkOption {
16-
type = types.enum [ "Primary" "Secondary" "Hint" "Forward" ];
16+
type = types.enum [ "Primary" "Secondary" "External" ];
1717
default = "Primary";
1818
description = ''
1919
One of:
2020
- "Primary" (the master, authority for the zone).
2121
- "Secondary" (the slave, replicated from the primary).
22-
- "Hint" (a cached zone with recursive resolver abilities).
23-
- "Forward" (a cached zone where all requests are forwarded to another resolver).
22+
- "External" (a cached zone that queries other nameservers).
2423
2524
For more details about these zone types, consult the documentation for BIND,
2625
though note that hickory-dns supports only a subset of BIND's zone types:
2726
<https://bind9.readthedocs.io/en/v9_18_4/reference.html#type>
2827
'';
2928
};
3029
file = mkOption {
31-
type = types.either types.path types.str;
32-
default = "${config.zone}.zone";
33-
defaultText = literalExpression ''"''${config.zone}.zone"'';
30+
type = types.nullOr (types.either types.path types.str);
31+
default = if config.zone_type != "External" then "${config.zone}.zone" else null;
32+
defaultText = literalExpression ''if config.zone_type != "External" then "''${config.zone}.zone" else null'';
3433
description = ''
3534
Path to the .zone file.
3635
If not fully-qualified, this path will be interpreted relative to the `directory` option.
37-
If omitted, defaults to the value of the `zone` option suffixed with ".zone".
36+
If omitted, defaults to the value of the `zone` option suffixed with ".zone" when `zone_type` isn't External; otherwise, defaults to `null`.
3837
'';
3938
};
4039
};
@@ -82,7 +81,7 @@ in
8281
configFile = mkOption {
8382
type = types.path;
8483
default = toml.generate "hickory-dns.toml" (
85-
lib.filterAttrsRecursive (_: v: v != null) cfg.settings
84+
lib.mapAttrs (_: v: if builtins.isList v then map (v: if builtins.isAttrs v then lib.filterAttrs (_: v: v != null) v else v) v else v) (lib.filterAttrsRecursive (_: v: v != null) cfg.settings)
8685
);
8786
defaultText = lib.literalExpression ''
8887
let toml = pkgs.formats.toml { }; in toml.generate "hickory-dns.toml" cfg.settings

0 commit comments

Comments
 (0)