summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
Diffstat (limited to 'sys')
-rw-r--r--sys/ns/rr.nix37
1 files changed, 35 insertions, 2 deletions
diff --git a/sys/ns/rr.nix b/sys/ns/rr.nix
index f1c6aca..3ccbd55 100644
--- a/sys/ns/rr.nix
+++ b/sys/ns/rr.nix
@@ -37,12 +37,13 @@ in
});
};
- rrConfig = { rrs, type, format }: (map
+ rrConfig = { rrs, type, format, applyName ? (rr: rr.name) }: (map
(rr: {
inherit type;
- inherit (rr) name ttl;
+ inherit (rr) ttl;
data = format rr;
+ name = applyName rr;
})
rrs);
in
@@ -168,6 +169,30 @@ in
host = nameOption;
};
+ srv = rrType {
+ host = nameOption;
+
+ port = mkOption {
+ type = port;
+ };
+
+ priority = mkOption {
+ type = int;
+ };
+
+ proto = mkOption {
+ type = enum [ "tcp" "udp" ];
+ };
+
+ service = mkOption {
+ type = str;
+ };
+
+ weight = mkOption {
+ type = int;
+ };
+ };
+
txt = rrType {
text = mkOption {
type = strMatching "[^\"\n\\]*\n?";
@@ -235,6 +260,14 @@ in
})
(rrConfig {
+ rrs = config.srv;
+ type = "SRV";
+
+ format = rr: [ rr.priority rr.weight rr.port rr.host ];
+ applyName = rr: "_${rr.service}._${rr.proto}.${rr.name}";
+ })
+
+ (rrConfig {
rrs = config.txt;
type = "TXT";