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 on localhost to allow only there
61 # dynamic updates for ACME challenges.
62 listen: 127.0.0.1@5353
72 # move databases below the state directory, because they need to be writable
73 storage: /var/lib/knot/zones
74 # Input-only zone files
75 # https://www.knot-dns.cz/docs/2.8/html/operation.html#example-3
76 # prevents modification of the zonefiles, since the zonefiles are immutable
78 zonefile-load: difference
79 journal-content: changes
80 global-module: mod-rrl/default
83 journal-db: /var/lib/knot/journal
84 kasp-db: /var/lib/knot/kasp
85 timer-db: /var/lib/knot/timer
96 address: 217.70.177.40@53
99 address: 78.192.65.63@53
102 - id: dnssec_validating_resolver
103 parent: local_resolver
107 single-type-signing: false
114 ksk-submission: dnssec_validating_resolver
117 single-type-signing: false
124 cds-cdnskey-publish: always
125 ksk-submission: dnssec_validating_resolver
128 # DOC: https://docs.gandi.net/en/domain_names/advanced_users/secondary_nameserver.html
130 address: 217.70.177.40
134 address: 78.192.65.63
137 '' + lib.concatStringsSep "\n" (lib.mapAttrsToList (domain: {conf, ...}: conf) knot.zones);