aboutsummaryrefslogtreecommitdiffstats
path: root/modules/vhack/dn/dns/module.nix
diff options
context:
space:
mode:
authorSoispha Peetz <soispha@b-peetz.de>2026-10-30 15:22:07 +0100
committerSoispha Peetz <soispha@b-peetz.de>2026-11-27 00:27:17 +0100
commit4834ad1ea13358f3f23e0139e3a8a3d1ccb804e2 (patch)
tree60b588b2d979bce6a6d19bd7acc0af05c90f12fd /modules/vhack/dn/dns/module.nix
parenttreewide: Various fixes (diff)
downloadnixos-server-4834ad1ea13358f3f23e0139e3a8a3d1ccb804e2.zip
modules: Rename back to `by-name`
There is no point in keeping just vhack here.
Diffstat (limited to 'modules/vhack/dn/dns/module.nix')
-rw-r--r--modules/vhack/dn/dns/module.nix86
1 files changed, 0 insertions, 86 deletions
diff --git a/modules/vhack/dn/dns/module.nix b/modules/vhack/dn/dns/module.nix
deleted file mode 100644
index 8f4ad37..0000000
--- a/modules/vhack/dn/dns/module.nix
+++ /dev/null
@@ -1,86 +0,0 @@
-{
- config,
- lib,
- ...
-}: let
- cfg = config.vhack.dns;
-
- zones =
- builtins.mapAttrs (name: value: {
- data =
- dns.types.zone.renderToString name value;
- })
- cfg.zones;
-
- dns = import ./dns {inherit lib;};
-
- ports = let
- parsePorts = listeners: let
- splitAddress = addr: lib.splitString "@" addr;
-
- extractPort = addr: let
- split = splitAddress addr;
- in
- lib.toInt (
- if (builtins.length split) == 2
- then builtins.elemAt split 1
- else "53"
- );
- in
- builtins.map extractPort listeners;
- in
- lib.unique (parsePorts cfg.interfaces);
-in {
- options.vhack.dns = {
- enable = lib.mkEnableOption "custom dns server";
-
- openFirewall = lib.mkOption {
- type = lib.types.bool;
- default = false;
- description = ''
- Open the following ports:
- TCP (${lib.concatStringsSep ", " (map toString ports)})
- UDP (${lib.concatStringsSep ", " (map toString ports)})
- '';
- };
-
- interfaces = lib.mkOption {
- type = lib.types.listOf lib.types.str;
- description = ''
- A list of the interfaces to bind to. To select the port add `@` to the end of the
- interface. The default port is 53.
- '';
- 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;
- verbosity = 4;
- inherit (cfg) interfaces;
- inherit zones;
- };
-
- networking.firewall.allowedUDPPorts = lib.mkIf cfg.openFirewall ports;
- networking.firewall.allowedTCPPorts = lib.mkIf cfg.openFirewall ports;
-
- systemd.services.nsd = {
- requires = [
- "network-online.target"
- ];
- after = [
- "network.target"
- "network-online.target"
- ];
- };
- };
-}