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 environment.systemPackages = [
38 systemd.services.knot.preStart = lib.concatStringsSep "\n" (lib.mapAttrsToList (domain: {data, ...}:
39 lib.optionalString (data != null) ''
40 install -D -o knot -g knot -m 700 ${pkgs.writeText "${domain}.zone" data} /var/lib/knot/zones/${domain}.zone
43 systemd.services.knot.postStart = lib.mkAfter ''
44 PATH="/run/current-system/sw/bin:$PATH"
45 knotc zone-freeze ${domain}.
46 while ! knotc zone-status ${domain}. +freeze | grep -q 'freeze: yes'; do sleep 1; done
47 knotc zone-flush ${domain}.
48 install -o knot -g knot -m 700 ${zone} /var/lib/knot/signed/${domain}.zone
49 knotc zone-reload ${domain}.
50 knotc zone-thaw ${domain}.
56 # https://www.knot-dns.cz/docs/2.6/html/reference.html
59 listen: 127.0.0.1@5353
69 # move databases below the state directory, because they need to be writable
70 storage: /var/lib/knot/zones
71 # Input-only zone files
72 # https://www.knot-dns.cz/docs/2.8/html/operation.html#example-3
73 # prevents modification of the zonefiles, since the zonefiles are immutable
75 zonefile-load: difference
76 journal-content: changes
77 global-module: mod-rrl/default
80 journal-db: /var/lib/knot/journal
81 kasp-db: /var/lib/knot/kasp
82 timer-db: /var/lib/knot/timer
93 address: 217.70.177.40@53
96 - id: dnssec_validating_resolver
97 parent: local_resolver
101 single-type-signing: false
108 ksk-submission: dnssec_validating_resolver
111 single-type-signing: false
118 cds-cdnskey-publish: always
119 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);