mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-12 20:55:31 +03:00
nixos/hickory-dns: make settings.zone
freeform; expose configFile
option (#363001)
This commit is contained in:
commit
382e7cbf49
1 changed files with 18 additions and 5 deletions
|
@ -3,11 +3,8 @@ let
|
||||||
cfg = config.services.hickory-dns;
|
cfg = config.services.hickory-dns;
|
||||||
toml = pkgs.formats.toml { };
|
toml = pkgs.formats.toml { };
|
||||||
|
|
||||||
configFile = toml.generate "hickory-dns.toml" (
|
|
||||||
lib.filterAttrsRecursive (_: v: v != null) cfg.settings
|
|
||||||
);
|
|
||||||
|
|
||||||
zoneType = lib.types.submodule ({ config, ... }: {
|
zoneType = lib.types.submodule ({ config, ... }: {
|
||||||
|
freeformType = toml.type;
|
||||||
options = with lib; {
|
options = with lib; {
|
||||||
zone = mkOption {
|
zone = mkOption {
|
||||||
type = types.str;
|
type = types.str;
|
||||||
|
@ -82,6 +79,22 @@ in
|
||||||
If neither `quiet` nor `debug` are enabled, logging defaults to the INFO level.
|
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 {
|
settings = mkOption {
|
||||||
description = ''
|
description = ''
|
||||||
Settings for hickory-dns. The options enumerated here are not exhaustive.
|
Settings for hickory-dns. The options enumerated here are not exhaustive.
|
||||||
|
@ -142,7 +155,7 @@ in
|
||||||
flags = (lib.optional cfg.debug "--debug") ++ (lib.optional cfg.quiet "--quiet");
|
flags = (lib.optional cfg.debug "--debug") ++ (lib.optional cfg.quiet "--quiet");
|
||||||
flagsStr = builtins.concatStringsSep " " flags;
|
flagsStr = builtins.concatStringsSep " " flags;
|
||||||
in ''
|
in ''
|
||||||
${lib.getExe cfg.package} --config ${configFile} ${flagsStr}
|
${lib.getExe cfg.package} --config ${cfg.configFile} ${flagsStr}
|
||||||
'';
|
'';
|
||||||
Type = "simple";
|
Type = "simple";
|
||||||
Restart = "on-failure";
|
Restart = "on-failure";
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue