ctucx.git: dns.nix

fork of https://github.com/kirelagin/dns.nix

1 
2 
3 
4 
5 
6 
7 
8 
9 
10 
11 
12 
13 
14 
15 
16 
17 
18 
19 
20 
21 
22 
23 
24 
25 
26 
27 
28 
29 
30 
31 
32 
33 
34 
35 
36 
37 
38 
39 
40 
41 
42 
43 
#
# SPDX-FileCopyrightText: 2019 Kirill Elagin <https://kir.elagin.me/>
#
# SPDX-License-Identifier: MPL-2.0 or MIT
#

{ lib }:

let
  dnslib = {
    util = import ./util { inherit lib; };
    inherit types;
  };
  types = import ./types { lib = lib'; };
  lib' = lib // { dns = dnslib; };

  combinators = import ./combinators.nix { lib = lib'; };

  evalZone = name: zone:
    (lib.evalModules {
      modules = [
        { options = {
            zones = lib.mkOption {
              type = lib.types.attrsOf types.zone;
              description = "DNS zones";
            };
          };
          config = {
            zones = { "${name}" = zone; };
          };
        }
      ];
    }).config.zones."${name}";

in

{
  inherit evalZone;

  inherit types;

  inherit combinators;
}