Skip to content

Commit

Permalink
purge: lib.mdDoc
Browse files Browse the repository at this point in the history
  • Loading branch information
Janik-Haag committed Apr 17, 2024
1 parent 8b5a7d6 commit ced7b2e
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 41 deletions.
2 changes: 1 addition & 1 deletion modules/defaultTTL.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# We do this because the option is needed by multiple modules
{ lib }:
lib.mkOption {
description = lib.mdDoc ''
description = ''
this ttl will be applied to any record not explicitly having one set.
'';
default = 3600;
Expand Down
6 changes: 3 additions & 3 deletions modules/dnsConfig.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
# todo
# darwin = lib.mkOption {
# default = { };
# description = lib.mdDoc ''
# description = ''
# '';
# visible = false;
# type = import ./darwin.nix;
# };
nixosConfigurations = lib.mkOption {
default = { };
description = lib.mdDoc ''
description = ''
Takes in the equivalent of the self.nixosConfigurations flake attribute.
'';
visible = "shallow";
Expand All @@ -21,7 +21,7 @@
extraConfig = lib.mkOption {
apply = x: if x != { } then x.zones else x;
default = { };
description = lib.mdDoc ''
description = ''
Takes in the extraConfig module.
'';
visible = "shallow";
Expand Down
2 changes: 1 addition & 1 deletion modules/extraConfig.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
defaultTTL = import ./defaultTTL.nix { inherit lib; };
zones = lib.mkOption {
default = { };
description = lib.mdDoc ''
description = ''
Takes in a attrset of domain apex and their entries.
'';
apply =
Expand Down
4 changes: 2 additions & 2 deletions modules/nixos.nix
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ in
defaultTTL = import ./defaultTTL.nix { inherit lib; };
baseDomains = lib.mkOption {
default = { };
description = lib.mdDoc ''
description = ''
Attribute set of domains and records for the subdomains to inherit.
'';
type = attrsOf (submodule {
options = records.base;
});
};
subDomains = lib.mkOption {
description = lib.mdDoc ''
description = ''
Attribute set of subdomains that inherit values from their matching domain.
'';
default = { };
Expand Down
68 changes: 34 additions & 34 deletions modules/records.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ let
lib.mkOption {
default = { };
# this description doesn't get rendered anywhere so we can just leave it empty
description = lib.mdDoc '''';
description = '''';
type = lib.types.submodule {
options = {
ttl = lib.mkOption {
description = lib.mdDoc ''
description = ''
The time to live (TTL) is a field on DNS records that tells you how
long the record is valid (in seconds) and thus when it will be
updated.
Expand Down Expand Up @@ -46,22 +46,22 @@ lib.mapAttrs
(n: v: func n (if (lib.hasAttrByPath [ "${type}" ] v) then (v.common // v.${type}) else v.common))
{
a.common = {
description = lib.mdDoc ''
description = ''
Commonly used to map a name to a list of IPv4 addresses.
'';
example = "9.9.9.9";
type = with lib.types; nullOr (coercedTo str (f: [ f ]) (listOf str)); # change me to lib.types.ipv4 once it exists
};
aaaa.common = {
description = lib.mdDoc ''
description = ''
Commonly used to map a name to a list of IPv6 addresses.
'';
example = "2620:fe::fe";
type = with lib.types; nullOr (coercedTo str (f: [ f ]) (listOf str)); # change me to lib.types.ipv6 once it exists
};
alias = {
common = {
description = lib.mdDoc ''
description = ''
Maps one domain name to another and uses the dns resolver of your dns server for responses.
'';
example = "foo.example.com";
Expand All @@ -79,7 +79,7 @@ lib.mapAttrs
};
cname = {
common = {
description = lib.mdDoc ''
description = ''
Same as alias but the requesting party will have to resolve the response which can lead to more latency.
'';
example = "foo.example.com";
Expand All @@ -97,7 +97,7 @@ lib.mapAttrs
};
};
caa.common = {
description = lib.mdDoc ''
description = ''
DNS Certification Authority Authorization, constraining acceptable CAs for a host/domain
'';
type =
Expand All @@ -106,7 +106,7 @@ lib.mapAttrs
caaSubModule = submodule {
options = {
flags = lib.mkOption {
description = lib.mdDoc ''
description = ''
A flags byte which implements an extensible signaling system for future use.
As of 2018, only the issuer critical flag has been defined, which instructs certificate authorities that they must understand the corresponding property tag before issuing a certificate.
This flag allows the protocol to be extended in the future with mandatory extensions, similar to critical extensions in X.509 certificates.
Expand All @@ -115,7 +115,7 @@ lib.mapAttrs
type = int;
};
tag = lib.mkOption {
description = lib.mdDoc ''
description = ''
Please take a look at [this list](https://en.wikipedia.org/wiki/DNS_Certification_Authority_Authorization#Record)
'';
example = "issue";
Expand All @@ -129,7 +129,7 @@ lib.mapAttrs
];
};
value = lib.mkOption {
description = lib.mdDoc ''
description = ''
The value associated with the chosen property tag.
'';
example = "letsencrypt.org";
Expand All @@ -146,7 +146,7 @@ lib.mapAttrs
};
dname = {
common = {
description = lib.mdDoc ''
description = ''
Same as cname but also gets applied to any subdomain of the given domain
'';
example = "foo.example.com";
Expand All @@ -164,7 +164,7 @@ lib.mapAttrs
};
};
ns.common = {
description = lib.mdDoc ''
description = ''
Nameserver responsible for your zone.
Note, that this option technically allows for only one name server but I would strongly advise against that.
'';
Expand All @@ -177,7 +177,7 @@ lib.mapAttrs
};
mx = {
common = {
description = lib.mdDoc ''
description = ''
List of mail exchange servers that accept email for this domain.
'';
type =
Expand All @@ -186,14 +186,14 @@ lib.mapAttrs
mxSubModule = submodule {
options = {
exchange = lib.mkOption {
description = lib.mdDoc ''
description = ''
Name of the mailserver
'';
example = "mail1.example.com";
type = lib.types.str;
};
preference = lib.mkOption {
description = lib.mdDoc ''
description = ''
Lower is better/more preferred over other entries.
'';
example = 10;
Expand All @@ -211,7 +211,7 @@ lib.mapAttrs
};
soa = {
common = {
description = lib.mdDoc ''
description = ''
Specifies authoritative information about a DNS zone.
'';
type =
Expand All @@ -220,50 +220,50 @@ lib.mapAttrs
soaSubModule = submodule {
options = {
mname = lib.mkOption {
description = lib.mdDoc ''
description = ''
This is the name of the primary nameserver for the zone. Secondary servers that maintain duplicates of the zone's DNS records receive updates to the zone from this primary server.
'';
example = "ns.example.com";
type = lib.types.str;
};
rname = lib.mkOption {
description = lib.mdDoc ''
description = ''
Email of zone administrators.
'';
example = "[email protected]";
type = lib.types.str;
apply = builtins.replaceStrings [ "@" ] [ "." ];
};
serial = lib.mkOption {
description = lib.mdDoc ''
description = ''
A zone serial number is a version number for the SOA record (the higher the newer). When the serial number changes in a zone file, this alerts secondary nameservers that they should update their copies of the zone file via a zone transfer. Usually most dns-utilities working with zonefiles increment it automatically.
'';
example = "";
type = lib.types.int;
};
refresh = lib.mkOption {
description = lib.mdDoc ''
description = ''
The length of time secondary servers should wait before asking primary servers for the SOA record to see if it has been updated.
'';
example = 86400;
type = lib.types.int;
};
retry = lib.mkOption {
description = lib.mdDoc ''
description = ''
The length of time a server should wait for asking an unresponsive primary nameserver for an update again.
'';
example = "";
type = lib.types.int;
};
expire = lib.mkOption {
description = lib.mdDoc ''
description = ''
If a secondary server does not get a response from the primary server for this amount of time, it should stop responding to queries for the zone.
'';
example = "";
type = lib.types.int;
};
ttl = lib.mkOption {
description = lib.mdDoc '''';
description = '''';
default = cfg.defaultTTL;
defaultText = lib.literalExpression "cfg.defaultTTL";
example = "";
Expand All @@ -287,14 +287,14 @@ lib.mapAttrs
in
{
default = null;
description = lib.mdDoc ''
description = ''
${spfText}
'';
type = lib.types.unspecified;
apply = x: lib.throwIfNot (x == null) spfText x;
};
srv.common = {
description = lib.mdDoc ''
description = ''
Specification of data in the Domain Name System defining the location, i.e., the hostname and port number, of servers for specified services. It is defined in RFC 2782.
'';
type =
Expand All @@ -303,28 +303,28 @@ lib.mapAttrs
srvSubModule = submodule {
options = {
priority = lib.mkOption {
description = lib.mdDoc ''
description = ''
The priority of the target host, lower value means more preferred.
'';
example = 10;
type = lib.types.int;
};
weight = lib.mkOption {
description = lib.mdDoc ''
description = ''
Relative weight for records with the same priority, higher value means more preferred.
'';
example = 1;
type = lib.types.int;
};
port = lib.mkOption {
description = lib.mdDoc ''
description = ''
The TCP or UDP port on which the service is to be found.
'';
example = 4731;
type = lib.types.int;
};
target = lib.mkOption {
description = lib.mdDoc ''
description = ''
The canonical hostname of the machine providing the service.
'';
example = "example.com";
Expand All @@ -341,15 +341,15 @@ lib.mapAttrs
apply = lib.toList;
};
txt.common = {
description = lib.mdDoc ''
description = ''
Just any string, commonly used to transfer machine readable metadata.
'';
example = "v=DMARC1; p=none";
type = with lib.types; nullOr (coercedTo str (f: [ f ]) (listOf str));
};
uri = {
common = {
description = lib.mdDoc ''
description = ''
Used for publishing mappings from hostnames to URIs.
'';
type =
Expand All @@ -358,21 +358,21 @@ lib.mapAttrs
uriSubModule = submodule {
options = {
priority = lib.mkOption {
description = lib.mdDoc ''
description = ''
The priority of the target host, lower value means more preferred.
'';
example = 10;
type = lib.types.int;
};
weight = lib.mkOption {
description = lib.mdDoc ''
description = ''
Relative weight for records with the same priority, higher value means more preferred.
'';
example = 1;
type = lib.types.int;
};
target = lib.mkOption {
description = lib.mdDoc ''
description = ''
The URI of the target, where the URI is as specified in RFC 3986
'';
example = "ftp://example.com/public";
Expand Down

0 comments on commit ced7b2e

Please sign in to comment.