diff --git a/nixos/modules/services/networking/hickory-dns.nix b/nixos/modules/services/networking/hickory-dns.nix index 1cd0b9901f1bb..6a6570e580172 100644 --- a/nixos/modules/services/networking/hickory-dns.nix +++ b/nixos/modules/services/networking/hickory-dns.nix @@ -3,10 +3,6 @@ let cfg = config.services.hickory-dns; toml = pkgs.formats.toml { }; - configFile = toml.generate "hickory-dns.toml" ( - lib.filterAttrsRecursive (_: v: v != null) cfg.settings - ); - zoneType = lib.types.submodule ({ config, ... }: { freeformType = toml.type; options = with lib; { @@ -83,6 +79,22 @@ in If neither `quiet` nor `debug` are enabled, logging defaults to the INFO level. ''; }; + configFile = mkOption { + type = types.path; + default = toml.generate "hickory-dns.toml" ( + lib.filterAttrsRecursive (_: v: v != null) cfg.settings + ); + defaultText = lib.literalExpression '' + let toml = pkgs.formats.toml { }; in toml.generate "hickory-dns.toml" cfg.settings + ''; + description = '' + Path to an existing toml file to configure hickory-dns with. + + This can usually be left unspecified, in which case it will be + generated from the values in `settings`. + If manually specified, then the options in `settings` are ignored. + ''; + }; settings = mkOption { description = '' Settings for hickory-dns. The options enumerated here are not exhaustive. @@ -143,7 +155,7 @@ in flags = (lib.optional cfg.debug "--debug") ++ (lib.optional cfg.quiet "--quiet"); flagsStr = builtins.concatStringsSep " " flags; in '' - ${lib.getExe cfg.package} --config ${configFile} ${flagsStr} + ${lib.getExe cfg.package} --config ${cfg.configFile} ${flagsStr} ''; Type = "simple"; Restart = "on-failure";