3
0
Fork 0
forked from mirrors/nixpkgs

nixos/knot: also allow config by YAML file

This commit is contained in:
Vladimír Čunát 2023-08-13 11:43:02 +02:00
parent 7fb737dde6
commit ce85980e77
No known key found for this signature in database
GPG key ID: E747DF1F9575A3AA

View file

@ -102,7 +102,10 @@ let
in result;
configFile = pkgs.writeTextFile {
configFile = if cfg.settingsFile != null then
assert cfg.settings == {} && cfg.keyFiles == [];
cfg.settingsFile
else pkgs.writeTextFile {
name = "knot.conf";
text = (concatMapStringsSep "\n" (file: "include: ${file}") cfg.keyFiles) + "\n" + yamlConfig;
# TODO: maybe we could do some checks even when private keys complicate this?
@ -165,6 +168,16 @@ in {
'';
};
settingsFile = mkOption {
type = types.nullOr types.path;
default = null;
description = lib.mdDoc ''
As alternative to ``settings``, you can provide whole configuration
directly in the almost-YAML format of Knot DNS.
You might want to utilize ``writeTextFile`` for this.
'';
};
package = mkOption {
type = types.package;
default = pkgs.knot-dns;