1 { pkgs, lib, config, ... }:
4 inherit (config.services) knot;
9 knot/sourcephile.fr.nix
11 options.services.knot = {
12 zones = lib.mkOption {
14 type = types.attrsOf (types.submodule ({domain, ...}: {
15 #config.domain = lib.mkDefault domain;
21 type = types.nullOr types.lines;
31 environment.systemPackages = [
39 systemd.services.knot.preStart = lib.concatStringsSep "\n" (lib.mapAttrsToList (domain: {data, ...}:
40 lib.optionalString (data != null) ''
41 install -D -o knot -g knot -m 700 ${pkgs.writeText "${domain}.zone" data} /var/lib/knot/zones/${domain}.zone
44 systemd.services.knot.postStart = lib.mkAfter ''
45 PATH="/run/current-system/sw/bin:$PATH"
46 knotc zone-freeze ${domain}.
47 while ! knotc zone-status ${domain}. +freeze | grep -q 'freeze: yes'; do sleep 1; done
48 knotc zone-flush ${domain}.
49 install -o knot -g knot -m 700 ${zone} /var/lib/knot/signed/${domain}.zone
50 knotc zone-reload ${domain}.
51 knotc zone-thaw ${domain}.
57 # https://www.knot-dns.cz/docs/2.6/html/reference.html
60 listen: 127.0.0.1@5353
70 # move databases below the state directory, because they need to be writable
71 storage: /var/lib/knot/zones
72 # Input-only zone files
73 # https://www.knot-dns.cz/docs/2.8/html/operation.html#example-3
74 # prevents modification of the zonefiles, since the zonefiles are immutable
76 zonefile-load: difference
77 journal-content: changes
78 global-module: mod-rrl/default
81 journal-db: /var/lib/knot/journal
82 kasp-db: /var/lib/knot/kasp
83 timer-db: /var/lib/knot/timer
94 address: 217.70.177.40@53
97 address: 78.192.65.63@53
100 - id: dnssec_validating_resolver
101 parent: local_resolver
105 single-type-signing: false
112 ksk-submission: dnssec_validating_resolver
115 single-type-signing: false
122 cds-cdnskey-publish: always
123 ksk-submission: dnssec_validating_resolver
126 # DOC: https://docs.gandi.net/en/domain_names/advanced_users/secondary_nameserver.html
128 address: 217.70.177.40
132 address: 78.192.65.63
135 '' + lib.concatStringsSep "\n" (lib.mapAttrsToList (domain: {conf, ...}: conf) knot.zones);