|
1 | 1 | { config, lib, pkgs, ... }: |
2 | 2 | let |
3 | | - cfg = config.services.trust-dns; |
| 3 | + cfg = config.services.hickory-dns; |
4 | 4 | toml = pkgs.formats.toml { }; |
5 | 5 |
|
6 | | - configFile = toml.generate "trust-dns.toml" ( |
| 6 | + configFile = toml.generate "hickory-dns.toml" ( |
7 | 7 | lib.filterAttrsRecursive (_: v: v != null) cfg.settings |
8 | 8 | ); |
9 | 9 |
|
|
26 | 26 | - "Forward" (a cached zone where all requests are forwarded to another resolver). |
27 | 27 |
|
28 | 28 | For more details about these zone types, consult the documentation for BIND, |
29 | | - though note that trust-dns supports only a subset of BIND's zone types: |
| 29 | + though note that hickory-dns supports only a subset of BIND's zone types: |
30 | 30 | <https://bind9.readthedocs.io/en/v9_18_4/reference.html#type> |
31 | 31 | ''; |
32 | 32 | }; |
|
45 | 45 | in |
46 | 46 | { |
47 | 47 | meta.maintainers = with lib.maintainers; [ colinsane ]; |
| 48 | + |
| 49 | + imports = with lib; [ |
| 50 | + (mkRenamedOptionModule [ "services" "trust-dns" "enable" ] [ "services" "hickory-dns" "enable" ]) |
| 51 | + (mkRenamedOptionModule [ "services" "trust-dns" "package" ] [ "services" "hickory-dns" "package" ]) |
| 52 | + (mkRenamedOptionModule [ "services" "trust-dns" "settings" ] [ "services" "hickory-dns" "settings" ]) |
| 53 | + (mkRenamedOptionModule [ "services" "trust-dns" "quiet" ] [ "services" "hickory-dns" "quiet" ]) |
| 54 | + (mkRenamedOptionModule [ "services" "trust-dns" "debug" ] [ "services" "hickory-dns" "debug" ]) |
| 55 | + ]; |
| 56 | + |
48 | 57 | options = { |
49 | | - services.trust-dns = with lib; { |
50 | | - enable = mkEnableOption "trust-dns"; |
51 | | - package = mkPackageOption pkgs "trust-dns" { |
| 58 | + services.hickory-dns = with lib; { |
| 59 | + enable = mkEnableOption "hickory-dns"; |
| 60 | + package = mkPackageOption pkgs "hickory-dns" { |
52 | 61 | extraDescription = '' |
53 | 62 | ::: {.note} |
54 | 63 | The package must provide `meta.mainProgram` which names the server binary; any other utilities (client, resolver) are not needed. |
|
75 | 84 | }; |
76 | 85 | settings = mkOption { |
77 | 86 | description = '' |
78 | | - Settings for trust-dns. The options enumerated here are not exhaustive. |
| 87 | + Settings for hickory-dns. The options enumerated here are not exhaustive. |
79 | 88 | Refer to upstream documentation for all available options: |
80 | | - - [Example settings](https://github.com/bluejekyll/trust-dns/blob/main/tests/test-data/test_configs/example.toml) |
| 89 | + - [Example settings](https://github.com/hickory-dns/hickory-dns/blob/main/tests/test-data/test_configs/example.toml) |
81 | 90 | ''; |
82 | 91 | type = types.submodule { |
83 | 92 | freeformType = toml.type; |
|
106 | 115 | }; |
107 | 116 | directory = mkOption { |
108 | 117 | type = types.str; |
109 | | - default = "/var/lib/trust-dns"; |
| 118 | + default = "/var/lib/hickory-dns"; |
110 | 119 | description = '' |
111 | | - The directory in which trust-dns should look for .zone files, |
| 120 | + The directory in which hickory-dns should look for .zone files, |
112 | 121 | whenever zones aren't specified by absolute path. |
113 | 122 | ''; |
114 | 123 | }; |
|
124 | 133 | }; |
125 | 134 |
|
126 | 135 | config = lib.mkIf cfg.enable { |
127 | | - systemd.services.trust-dns = { |
128 | | - description = "trust-dns Domain Name Server"; |
129 | | - unitConfig.Documentation = "https://trust-dns.org/"; |
| 136 | + systemd.services.hickory-dns = { |
| 137 | + description = "hickory-dns Domain Name Server"; |
| 138 | + unitConfig.Documentation = "https://hickory-dns.org/"; |
130 | 139 | serviceConfig = { |
131 | 140 | ExecStart = |
132 | 141 | let |
133 | 142 | flags = (lib.optional cfg.debug "--debug") ++ (lib.optional cfg.quiet "--quiet"); |
134 | 143 | flagsStr = builtins.concatStringsSep " " flags; |
135 | 144 | in '' |
136 | | - ${cfg.package}/bin/${cfg.package.meta.mainProgram} --config ${configFile} ${flagsStr} |
| 145 | + ${lib.getExe cfg.package} --config ${configFile} ${flagsStr} |
137 | 146 | ''; |
138 | 147 | Type = "simple"; |
139 | 148 | Restart = "on-failure"; |
140 | 149 | RestartSec = "10s"; |
141 | 150 | DynamicUser = true; |
142 | 151 |
|
143 | | - StateDirectory = "trust-dns"; |
| 152 | + StateDirectory = "hickory-dns"; |
144 | 153 | ReadWritePaths = [ cfg.settings.directory ]; |
145 | 154 |
|
146 | 155 | AmbientCapabilities = [ "CAP_NET_BIND_SERVICE" ]; |
|
0 commit comments