removed throw, renamed services.named to services.bind
This commit is contained in:
parent
1484f3a04e
commit
1f5eda31b2
@ -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 [
|
config = lib.mkMerge [
|
||||||
# BIND DNS Server Configuration
|
|
||||||
(lib.mkIf cfg.bind.enable {
|
(lib.mkIf cfg.bind.enable {
|
||||||
services.named = {
|
services.bind = {
|
||||||
enable = true;
|
enable = true;
|
||||||
interfaces = cfg.bind.settings.interfaces;
|
interfaces = cfg.bind.settings.interfaces;
|
||||||
zones =
|
zones =
|
||||||
@ -97,9 +90,7 @@ in {
|
|||||||
environment.systemPackages = [pkgs.bind];
|
environment.systemPackages = [pkgs.bind];
|
||||||
})
|
})
|
||||||
|
|
||||||
# Technitium DNS Server Configuration
|
|
||||||
(lib.mkIf cfg.technitium.enable {
|
(lib.mkIf cfg.technitium.enable {
|
||||||
# Create a systemd service for Technitium
|
|
||||||
systemd.services.technitium-dns = {
|
systemd.services.technitium-dns = {
|
||||||
description = "Technitium DNS Server";
|
description = "Technitium DNS Server";
|
||||||
wantedBy = ["multi-user.target"];
|
wantedBy = ["multi-user.target"];
|
||||||
@ -123,8 +114,8 @@ in {
|
|||||||
};
|
};
|
||||||
|
|
||||||
networking.firewall = {
|
networking.firewall = {
|
||||||
allowedTCPPorts = [cfg.technitium.settings.port];
|
allowedTCPPorts = [53 cfg.technitium.settings.port];
|
||||||
allowedUDPPorts = [cfg.technitium.settings.port];
|
allowedUDPPorts = [53 cfg.technitium.settings.port];
|
||||||
};
|
};
|
||||||
|
|
||||||
environment.systemPackages = [pkgs.technitium];
|
environment.systemPackages = [pkgs.technitium];
|
||||||
|
Loading…
Reference in New Issue
Block a user