|
13 | 13 | '';
|
14 | 14 | };
|
15 | 15 | zone_type = mkOption {
|
16 |
| - type = types.enum [ "Primary" "Secondary" "Hint" "Forward" ]; |
| 16 | + type = types.enum [ "Primary" "Secondary" "External" ]; |
17 | 17 | default = "Primary";
|
18 | 18 | description = ''
|
19 | 19 | One of:
|
20 | 20 | - "Primary" (the master, authority for the zone).
|
21 | 21 | - "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). |
24 | 23 |
|
25 | 24 | For more details about these zone types, consult the documentation for BIND,
|
26 | 25 | though note that hickory-dns supports only a subset of BIND's zone types:
|
27 | 26 | <https://bind9.readthedocs.io/en/v9_18_4/reference.html#type>
|
28 | 27 | '';
|
29 | 28 | };
|
30 | 29 | 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''; |
34 | 33 | description = ''
|
35 | 34 | Path to the .zone file.
|
36 | 35 | 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`. |
38 | 37 | '';
|
39 | 38 | };
|
40 | 39 | };
|
|
82 | 81 | configFile = mkOption {
|
83 | 82 | type = types.path;
|
84 | 83 | 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) |
86 | 85 | );
|
87 | 86 | defaultText = lib.literalExpression ''
|
88 | 87 | let toml = pkgs.formats.toml { }; in toml.generate "hickory-dns.toml" cfg.settings
|
|
0 commit comments