summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorVladimír Čunát <v@cunat.cz>2023-08-13 11:43:02 +0200
committerVladimír Čunát <v@cunat.cz>2023-09-23 10:04:02 +0200
commitce85980e77ab1abbd91f127bea24534c703e05bb (patch)
tree3f1ca08b39ca8b1226f306df6fd0badd0366bde8 /nixos
parent7fb737dde6a77cc78f083915e44e8a6a5a0c65c6 (diff)
downloadnixpkgs-ce85980e77ab1abbd91f127bea24534c703e05bb.tar
nixpkgs-ce85980e77ab1abbd91f127bea24534c703e05bb.tar.gz
nixpkgs-ce85980e77ab1abbd91f127bea24534c703e05bb.tar.bz2
nixpkgs-ce85980e77ab1abbd91f127bea24534c703e05bb.tar.lz
nixpkgs-ce85980e77ab1abbd91f127bea24534c703e05bb.tar.xz
nixpkgs-ce85980e77ab1abbd91f127bea24534c703e05bb.tar.zst
nixpkgs-ce85980e77ab1abbd91f127bea24534c703e05bb.zip
nixos/knot: also allow config by YAML file
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/services/networking/knot.nix15
1 files changed, 14 insertions, 1 deletions
diff --git a/nixos/modules/services/networking/knot.nix b/nixos/modules/services/networking/knot.nix
index f8aa6f562c9..58ebcb81898 100644
--- a/nixos/modules/services/networking/knot.nix
+++ b/nixos/modules/services/networking/knot.nix
@@ -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;