Browse Source

pkgs/dns-slaves: init

master
Astro 1 month ago
parent
commit
88e67c827b
2 changed files with 27 additions and 1 deletions
  1. 5
    1
      nix/pkgs/default.nix
  2. 22
    0
      nix/pkgs/dns-slaves.nix

+ 5
- 1
nix/pkgs/default.nix View File

@@ -55,7 +55,11 @@ let
55 55
     inherit self nixpkgs system;
56 56
   };
57 57
 
58
+  dns-slaves = import ./dns-slaves.nix {
59
+    inherit self nixpkgs system;
60
+  };
61
+
58 62
 in
59 63
 salt-pillars // rootfs-packages // vm-packages // device-templates // {
60
-  inherit export-config;
64
+  inherit export-config dns-slaves;
61 65
 }

+ 22
- 0
nix/pkgs/dns-slaves.nix View File

@@ -0,0 +1,22 @@
1
+{ self, nixpkgs, system }:
2
+
3
+with nixpkgs.legacyPackages.${system};
4
+
5
+writeText "named.slave.conf" (
6
+  lib.concatMapStringsSep "\n" ({ name, ns, ... }: ''
7
+    zone "${name}" IN {
8
+      type slave;
9
+      masters {
10
+        2a02:8106:208:5282:2::2;
11
+        fd23:42:c3d2:582:2::2;
12
+        172.20.73.2;
13
+      };
14
+      file "/var/lib/bind/slave/${name}.zone";
15
+    };
16
+  '') (
17
+    # public zones only
18
+    builtins.filter ({ ns, ... }:
19
+      ns == self.lib.dns.publicNS
20
+    ) self.lib.dns.localZones
21
+  )
22
+)

Loading…
Cancel
Save