commit 27ccedfd1996a47bc89f7ba4e44889029796ca24
parent 6d8fc64452948048710ca70f57369580259ae96f
Author: Kirill Elagin <kirelagin@gmail.com>
Date: Fri, 8 Mar 2019 20:26:40 +0100
parent 6d8fc64452948048710ca70f57369580259ae96f
Author: Kirill Elagin <kirelagin@gmail.com>
Date: Fri, 8 Mar 2019 20:26:40 +0100
Move example zone from default.nix to test.nix
3 files changed, 48 insertions(+), 36 deletions(-)
diff --git a/README.md b/README.md @@ -8,5 +8,4 @@ This repository provies: 1. NixOS-style module definitions that describe DNS zones. 2. A DSL to make building DNS zones easier. (Not implemented yet.) -See `default.nix` for an example module. -Run `nix-build` to get an example of a zone built from a module. +See `test.nix` for an example of a zone. Run `nix-build test.nix` to get this zone written to a file.
diff --git a/default.nix b/default.nix @@ -8,39 +8,8 @@ let dns = import ./dns { inherit pkgs; }; - - testZone = { - SOA = { - nameServer = "ns.test.com"; - adminEmail = "admin@test.com"; - serial = 2019030800; - }; - - NS = [ - { nsdname = "ns.test.com"; } - { nsdname = "ns2.test.com"; } - ]; - - A = [ - { address = "1.1.1.1"; ttl = 60 * 60; } - { address = "1.0.0.1"; ttl = 60 * 60; } - ]; - - CAA = [ - { issuerCritical = false; - tag = "issue"; - value = "letsencrypt.org"; - } - { issuerCritical = false; - tag = "issuewild"; - value = ";"; - } - { issuerCritical = false; - tag = "iodef"; - value = "mailto:admin@example.com"; - } - ]; - }; in -dns.writeZone "test.com" testZone +{ + inherit (dns) evalZone writeZone; +}
diff --git a/test.nix b/test.nix @@ -0,0 +1,44 @@ +# +# © 2019 Kirill Elagin <kirelagin@gmail.com> +# +# SPDX-License-Identifier: MIT +# + +let + dns = import ./. { }; + + testZone = { + SOA = { + nameServer = "ns.test.com"; + adminEmail = "admin@test.com"; + serial = 2019030800; + }; + + NS = [ + { nsdname = "ns.test.com"; } + { nsdname = "ns2.test.com"; } + ]; + + A = [ + { address = "1.1.1.1"; ttl = 60 * 60; } + { address = "1.0.0.1"; ttl = 60 * 60; } + ]; + + CAA = [ + { issuerCritical = false; + tag = "issue"; + value = "letsencrypt.org"; + } + { issuerCritical = false; + tag = "issuewild"; + value = ";"; + } + { issuerCritical = false; + tag = "iodef"; + value = "mailto:admin@example.com"; + } + ]; + }; +in + +dns.writeZone "test.com" testZone