From c918238932f0d776666e552b8ccf353375703249 Mon Sep 17 00:00:00 2001 From: Alejandro Soto Date: Sun, 4 Aug 2024 16:36:17 -0600 Subject: sys/ns: initial commit --- sys/ns/nsd.nix | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 sys/ns/nsd.nix (limited to 'sys/ns/nsd.nix') diff --git a/sys/ns/nsd.nix b/sys/ns/nsd.nix new file mode 100644 index 0000000..46ec1e6 --- /dev/null +++ b/sys/ns/nsd.nix @@ -0,0 +1,37 @@ +{ config, lib, ... }: +with lib; let + cfg = config.local.ns.server; +in +{ + options.local.ns.server = { + enable = mkEnableOption "nsd authoritative server"; + }; + + config = mkIf cfg.enable { + networking.firewall = + let + inherit (config.services.nsd) port; + in + { + allowedTCPPorts = [ port ]; + allowedUDPPorts = [ port ]; + }; + + services.nsd = { + enable = true; + + ipFreebind = true; + + bind8Stats = true; + statistics = 3600; + + tcpCount = 128; + tcpTimeout = 30; + tcpQueryCount = 128; + + zones = mapAttrs + (_: zone: { data = zone.content; }) + config.local.ns.zones; + }; + }; +} -- cgit v1.2.3