1 { pkgs, lib, config, ... }:
4 inherit (config.services) knot;
8 knot/sourcephile.fr.nix
10 options.services.knot = {
11 zones = lib.mkOption {
13 type = types.attrsOf (types.submodule ({domain, ...}: {
14 #config.domain = lib.mkDefault domain;
20 type = types.nullOr types.lines;
30 systemd.services.knot.preStart = lib.concatStringsSep "\n" (lib.mapAttrsToList (domain: {data, ...}:
31 lib.optionalString (data != null) ''
32 install -D -o knot -g knot -m 700 ${pkgs.writeText "${domain}.zone" data} /var/lib/knot/zones/${domain}.zone
35 systemd.services.knot.postStart = lib.mkAfter ''
36 PATH="/run/current-system/sw/bin:$PATH"
37 knotc zone-freeze ${domain}.
38 while ! knotc zone-status ${domain}. +freeze | grep -q 'freeze: yes'; do sleep 1; done
39 knotc zone-flush ${domain}.
40 install -o knot -g knot -m 700 ${zone} /var/lib/knot/signed/${domain}.zone
41 knotc zone-reload ${domain}.
42 knotc zone-thaw ${domain}.
48 # https://www.knot-dns.cz/docs/2.6/html/reference.html
51 listen: 127.0.0.1@5353
61 # move databases below the state directory, because they need to be writable
62 storage: /var/lib/knot/zones
63 # Input-only zone files
64 # https://www.knot-dns.cz/docs/2.8/html/operation.html#example-3
65 # prevents modification of the zonefiles, since the zonefiles are immutable
67 zonefile-load: difference
68 journal-content: changes
69 global-module: mod-rrl/default
72 journal-db: /var/lib/knot/journal
73 kasp-db: /var/lib/knot/kasp
74 timer-db: /var/lib/knot/timer
85 address: 217.70.177.40@53
88 - id: dnssec_validating_resolver
89 parent: local_resolver
93 single-type-signing: false
100 ksk-submission: dnssec_validating_resolver
103 single-type-signing: false
110 cds-cdnskey-publish: always
111 ksk-submission: dnssec_validating_resolver
122 # DOC: https://docs.gandi.net/en/domain_names/advanced_users/secondary_nameserver.html
124 address: 217.70.177.40
127 '' + lib.concatStringsSep "\n" (lib.mapAttrsToList (domain: {conf, ...}: conf) knot.zones);