aboutsummaryrefslogtreecommitdiffstats
path: root/modules/by-name/dn/dns/module.nix
diff options
context:
space:
mode:
Diffstat (limited to 'modules/by-name/dn/dns/module.nix')
-rw-r--r--modules/by-name/dn/dns/module.nix45
1 files changed, 45 insertions, 0 deletions
diff --git a/modules/by-name/dn/dns/module.nix b/modules/by-name/dn/dns/module.nix
new file mode 100644
index 0000000..6611f8c
--- /dev/null
+++ b/modules/by-name/dn/dns/module.nix
@@ -0,0 +1,45 @@
+{
+ config,
+ lib,
+ ...
+}: let
+ cfg = config.vhack.dns;
+
+ zones = lib.debug.traceValSeqN 2 (
+ builtins.mapAttrs (name: value: {
+ data =
+ dns.types.zone.renderToString name value;
+ })
+ (lib.debug.traceValSeqN 4 cfg.zones)
+ );
+
+ dns = import ./dns {inherit lib;};
+in {
+ options.vhack.dns = {
+ enable = lib.mkEnableOption "custom dns server";
+
+ interfaces = lib.mkOption {
+ type = lib.types.listOf lib.types.str;
+ description = ''
+ A list of the interfaces to bind to.
+ '';
+ example = [
+ "192.168.1.3"
+ "2001:db8:1::3"
+ ];
+ };
+
+ zones = lib.mkOption {
+ type = lib.types.attrsOf dns.types.zone.zone;
+ description = "DNS zones";
+ };
+ };
+
+ config = lib.mkIf cfg.enable {
+ services.nsd = {
+ enable = true;
+ inherit (cfg) interfaces;
+ inherit zones;
+ };
+ };
+}