Appliance server setup #4
@ -69,16 +69,9 @@ in {
|
||||
};
|
||||
};
|
||||
|
||||
# Validate that only one DNS server is enabled
|
||||
imports = [
|
||||
(lib.mkIf (cfg.bind.enable && cfg.technitium.enable) (throw "Only one DNS server can be enabled at a time"))
|
||||
];
|
||||
|
||||
# Implementation of the configuration
|
||||
config = lib.mkMerge [
|
||||
# BIND DNS Server Configuration
|
||||
(lib.mkIf cfg.bind.enable {
|
||||
services.named = {
|
||||
services.bind = {
|
||||
enable = true;
|
||||
interfaces = cfg.bind.settings.interfaces;
|
||||
zones =
|
||||
@ -97,9 +90,7 @@ in {
|
||||
environment.systemPackages = [pkgs.bind];
|
||||
})
|
||||
|
||||
# Technitium DNS Server Configuration
|
||||
(lib.mkIf cfg.technitium.enable {
|
||||
# Create a systemd service for Technitium
|
||||
systemd.services.technitium-dns = {
|
||||
description = "Technitium DNS Server";
|
||||
wantedBy = ["multi-user.target"];
|
||||
@ -123,8 +114,8 @@ in {
|
||||
};
|
||||
|
||||
networking.firewall = {
|
||||
allowedTCPPorts = [cfg.technitium.settings.port];
|
||||
allowedUDPPorts = [cfg.technitium.settings.port];
|
||||
allowedTCPPorts = [53 cfg.technitium.settings.port];
|
||||
allowedUDPPorts = [53 cfg.technitium.settings.port];
|
||||
};
|
||||
|
||||
environment.systemPackages = [pkgs.technitium];
|
||||
|
Loading…
Reference in New Issue
Block a user