Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions dns/types/simple.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,21 @@
let
inherit (builtins) stringLength;

# RFC 1035, 3.1
domain-name = lib.types.addCheck lib.types.nonEmptyStr (s: stringLength s <= 255) // {
description = "an RFC 1035 DNS domain name";
};
in

{
# RFC 1035, 3.1
domain-name = lib.types.addCheck lib.types.str (s: stringLength s <= 255);
inherit domain-name;

# RFC 2181, section 11
domain-label = lib.types.addCheck lib.types.nonEmptyStr (s: stringLength s <= 63) // {
description = "a DNS label";
};

fqdn = lib.types.addCheck domain-name (lib.strings.hasSuffix ".") // {
description = "a fully-qualified DNS domain name";
};
}