From 2b497b497c67b6183b6ad13ac1d76255fcadfebe Mon Sep 17 00:00:00 2001 From: Brendan Golden Date: Tue, 17 Jan 2023 22:56:05 +0000 Subject: [PATCH] feat: setting it up better --- applications/dns.nix | 70 +++++++++++++++++++++++++++++++++----------- 1 file changed, 53 insertions(+), 17 deletions(-) diff --git a/applications/dns.nix b/applications/dns.nix index 6ef507f..c3e0079 100644 --- a/applications/dns.nix +++ b/applications/dns.nix @@ -1,23 +1,59 @@ -{ lib, pkgs, config, ... }: { - - services.bind = { - enable = true; - - forwarders = [ - # these were in old config file - "193.1.100.130" - "193.1.100.131" - ]; - - skynet.ie = { - extraConfig = ""; - file = ./dns/skynet; - master = true; - masters = []; - slaves = [ ]; +{ lib, pkgs, config, ... }: +let + cfg = config.skynet_dns; +in { + options = { + skynet_dns = { + enable = lib.mkEnableOption { + default = false; + example = true; + description = "Skynet DNS"; + type = lib.types.bool; }; + + records = { + external = lib.mkOption { + default = [ ]; + type = lib.types.listOf lib.types.str; + description = '' + External records like: agentjones A 193.1.99.72 + ''; + }; + + cname = lib.mkOption { + default = [ ]; + type = lib.types.listOf lib.types.str; + description = '' + External records like: ns1 CNAME ns1 + ''; + }; + }; + + }; }; + config = lib.mkIf cfg.enable { + services.bind = { + enable = true; + + forwarders = [ + # these were in old config file + "193.1.100.130" + "193.1.100.131" + ]; + + skynet.ie = { + extraConfig = ""; + file = ./dns/skynet; + master = true; + masters = []; + slaves = [ ]; + }; + }; + + }; + + } \ No newline at end of file