domains

utils.domains.getParts

Type: utils.domains.getParts :: String -> [ String ]

Convert a string like "example.org" to a list like [ "example" "org" ]

domains

: String of a domain

utils.domains.comparePart

Type: utils.domains.compareParts :: String, Null -> String, Null -> Int

Compare domain parts and give them a value If sub and base match they are valued 1 If sub and base don't match but base is null return 0 And in every other case return -1

sub

: the sub domain part you want to compare

base

: the base domain part you want to compare

utils.domains.comparableParts

Type: utils.domains.comparableParts :: String -> String -> { sub :: [ Null, String ], base [ Null, String ] }

uses fillList to generate two lists of domain parts, that are easily comparable. Will return attrSet like:

{
  sub = [ "my" "fancy" "example" "com" ]
  base = [ null null "example" "com" ]
}

subDomain

: subDomain you want to compare

baseDomain

: baseDomain you want to compare

utils.domains.rate

Type: utils.domains.rate :: [ String ] -> [ String ] -> [ Int ]

This returns a list like [ 0 (-1) 1 1 ] Which contains the order comparison of a sub domain and a base domain

subDomain

: expects a deconstructed domain like [ "example" "com" ]

baseDomain

: expects a deconstructed domain like [ "my" "example" "com" ]

utils.domains.construct

Type: utils.domains.construct :: [ String ] -> String

Expects a list of domain parts like [ "ns" "example" "com" ] and builds a domain from it, in this case: ns.example.com

parts

: list of domain parts to construct

utils.domains.validateSubDomain

Type: utils.domains.validateSubDomain :: [ String ] -> [ String ] -> { valid :: Bool, value :: Int }

This returns a attrSet like

{
  valid = true;
  value = 2;
}

with valid telling you if the sub domain corresponds to the base domain and value telling you how close it is (higher is better) let's take for example: [ "my" "example" "com" ] as sub domain and [ "example" "com" ] as base domain, this would return the attrSet shown above. Because [ "example" "com" ] will expand to [ null "example" "com" ] and then get rated like:

"my" == null = 0
"example" == "example" = 1
"com" == "com" = 1

the domain is valid since there is no negative value and the total value is 2

subDomain

: takes the same input as ratedDomain

baseDomain

: takes the same input as ratedDomain

utils.domains.getMostSpecific

Type: utils.domains.getMostSpecific :: String -> [ String ] -> String, Null

This function takes a sub domain and a list of domains, and will find the most similar domain from the list. It does this by comparing the domain parts and not singe letters so if we have sub domain.example.com and [ sub.example.com example.com ] then we would get example.com as a result. If the sub domain doesn't have a matching one in the list the function will return null

subDomain

: a string of a domain like "example.com"

baseDomains

: Function argument

utils.domains.mapBaseToSub

Type: utils.domains.mapBaseToSub :: String -> Attr -> String -> Any

This Functions uses getMostSpecific to get the value of a corresponding key for a sub domain

subDomain

: takes a attrSet like the one provided by networking.domains.subDomains

baseDomains

: takes a attrSet like the one provided by `networking.domains.baseDomains

value

: the key from which to get the value

utils.domains.getDomainsFromNixosConfigurations

Type: utils.domains.getDomainsFromNixosConfigurations :: Attr -> Attr

Be care full when using this, since you might end up overwriting previous results because if a key is defined multiple times only the last value will remain except if the value is a list then all of the content will be merged

nixosConfigurations

: Function argument

utils.domains.getDnsConfig

Type: utils.domains.getDnsConfig :: Attr -> Attr

Expects a attribute-set like:

{
inherit (self) nixosConfigurations darwinConfigurations;
extraConfig = import ./dns.nix;
}

it will do special casing for the keys nixosConfigurations (and potentially darwinConfiguratiosn) and every other key is expected to have a attrs that looks like the output of utils.debug it will then go ahead and merge all the dns configs into one.

config

: Function argument