Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix some typos #3

Merged
merged 1 commit into from
Dec 13, 2023
Merged
Show file tree
Hide file tree
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
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ I started using octodns as dns deployment tool some time ago which works like a
But it bothered me that every time I wrote a new service config, I had to not just go and define the domain in the module but also in the octodns config.
Which got particularly annoying because of context switches between nix and yaml.
But not just that, it also prevented me from using nix's awesome versatility when it comes to dns,
for example I have a `prometheus-node-exporter.nix` which get's imported by every server in my flake,
for example I have a `prometheus-node-exporter.nix` which gets imported by every server in my flake,
and has a let binding at the top defining:
```nix
domain = "${config.networking.hostName}.prometheus.${config.networking.domain}";
```
which automatically generates a domain like `myHost1.prometheus.example.com` for every server that imports it.
There is just a small problem I now also have to add a entry for every host to my octodns config, which also makes the nixos module less portable.
So I had the idea of writing a NixOS module that provides domain meta data per host and per module, to automagically generate dns entrys from.
There is just a small problem: I now also have to add a entry for every host to my octodns config, which also makes the nixos module less portable.
So I had the idea of writing a NixOS module that provides domain meta data per host and per module, to automagically generate dns entries from.
Which ended up as `networking.domains.baseDomains` and `networking.domains.subDomains`. The idea is that you use `baseDomains` on a per host basis which will
define the default value for every subDomain that matches a baseDomain.
define the default value for every subDomain that matches a baseDomain,
and then use `subDomains` in your modules.
2 changes: 1 addition & 1 deletion docs/book/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ all of these are in the projects nix devshell so just run `nix develop` or `dire

Uses the same module system as nixpkgs.
Documentation builds fail if any description field is empty, so be sure to add one.
If a default module value is not a primary data type but tries to evalute a function add the defaultText string,
If a default module value is not a primary data type but tries to evaluate a function add the defaultText string,
otherwise documentation builds will fail.

Please document breaking changes in the `CHANGELOG.md`
Expand Down
16 changes: 8 additions & 8 deletions docs/book/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ This would probably be a easy contribution if you are more familiar.

```nix
{
# You off course have to add the `nixos-dns` input like:
# You of course have to add the `nixos-dns` input like:
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
nixos-dns.url = "github:Janik-Haag/nixos-dns";
Expand All @@ -24,7 +24,7 @@ This would probably be a easy contribution if you are more familiar.
nixpkgs,
nixos-dns
}: let
# You probably know this but flake outputs are architecture depended,
# You probably know this but flake outputs are architecture dependent,
# so we use this little helper function. Many people use `github:numtide/flake-utils` for that.
forAllSystems = nixpkgs.lib.genAttrs [ "x86_64-linux" "aarch64-linux" ];
in {
Expand Down Expand Up @@ -61,7 +61,7 @@ This would probably be a easy contribution if you are more familiar.

## NixOS Module

NixOS-DNS was built to decouple modules even more from there host.
NixOS-DNS was built to decouple modules even more from their host.
To achieve this we have the concept of `baseDomains` and `subDomains`.

In a nixos hosts configuration you would do something like:
Expand All @@ -85,7 +85,7 @@ You might notice the `.data` behind any record, this is because you might want t
As you can see above the `.ttl` isn't specifically added to every record, this is because there is `networking.domains.defaultTTL`
So every `record` has two fields `ttl` and `data`, the data type differs based on the record, for more info please refer to the module docs.

And Inside of a module you would do something like:
And inside of a module you would do something like:
```nix
networking.domains.subDomains."grafana.example.com" = { };
```
Expand All @@ -110,7 +110,7 @@ So this would produce this set:

> **note**
>
> baseDomains and there records don't end up in zone files, octodns configs, or any other output for that matter
> baseDomains and their records don't end up in zone files, octodns configs, or any other output for that matter
> So in the example above for "example.com" to end up in a zone file you would have to add:
> ```nix
> networking.domains.subDomains."example.com" = { };
Expand All @@ -124,7 +124,7 @@ Nix supports `${}` operations inside of attrsets, so you can get creative and do
networking.domains.subDomains."${networking.hostname}.prometheus.example.com" = { };
```

NixOS-DNS does a bunch of magic to automatically map subDomains to there closest baseDomain and throws an error if there is no matching baseDomain.
NixOS-DNS does a bunch of magic to automatically map subDomains to their closest baseDomain and throws an error if there is no matching baseDomain.
So if we have:
```nix
networking.domains.baseDomains = {
Expand Down Expand Up @@ -158,8 +158,8 @@ And `example.net` just wouldn't get matched, but that's fine since it is a baseD
You probably want to add some more information, to do so you can use the extraConfiguration key in the dnsConfig.
Please take a look at [the example](https://github.com/Janik-Haag/nixos-dns/tree/main/example/dns.nix) for usage information.

All the hosts in `nixosConfigurations` and `extraConfig` get merged and nothing get's overwritten.
So if you define multiple domains with the same records all the record data get's merged.
All the hosts in `nixosConfigurations` and `extraConfig` get merged and nothing gets overwritten.
So if you define multiple domains with the same records all the record data gets merged.

## octodns

Expand Down
2 changes: 1 addition & 1 deletion docs/modules.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
There is a module for NixOS and a module for extraConfig.
They both take the same record values and have the same assertions.
Please take a look at the coming pages for a list of available options.
I currently have trouble rendering the record fields if there type is a sub module,
I currently have trouble rendering the record fields if their type is a sub module,
if you are interested in any like caa or mx, you'll sadly have to take a look at [the source](https://github.com/Janik-Haag/NixOS-DNS/tree/main/modules/records.nix) for now.
2 changes: 1 addition & 1 deletion modules/extraConfig.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
zones = lib.mkOption {
default = { };
description = lib.mdDoc ''
Takes in a attrset of domain apex and there entries.
Takes in a attrset of domain apex and their entries.
'';
apply = x: lib.filterAttrsRecursive
(n: v:
Expand Down
4 changes: 2 additions & 2 deletions modules/nixos.nix
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ in
};
subDomains = lib.mkOption {
description = lib.mdDoc ''
Attribute set of subdomains that inherit values from there matching domain.
Attribute set of subdomains that inherit values from their matching domain.
'';
default = { };
apply = lib.filterAttrsRecursive (n: v:
Expand Down Expand Up @@ -64,7 +64,7 @@ in
{
assertion = true;
message = ''
Alais assertion, same as CNAME but a alias is allowed as zone apex
Alias assertion, same as CNAME but a alias is allowed as zone apex
'';
}
{
Expand Down
8 changes: 4 additions & 4 deletions modules/records.nix
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,14 @@ lib.mapAttrs
{
a.common = {
description = lib.mdDoc ''
Commonly used to map a name to a list of IPv4 address's.
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 ''
Commonly used to map a name to a list of IPv6 address's.
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
Expand Down Expand Up @@ -136,7 +136,7 @@ lib.mapAttrs
dname = {
common = {
description = lib.mdDoc ''
Same as cname but also get's applied to any subdomain of the given domain
Same as cname but also gets applied to any subdomain of the given domain
'';
example = "foo.example.com";
type = with lib.types; nullOr str; # change str to lib.types.domain once it exists
Expand Down Expand Up @@ -209,7 +209,7 @@ lib.mapAttrs
};
serial = lib.mkOption {
description = lib.mdDoc ''
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-utiltiltys working with zonefiles increment it automatically.
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;
Expand Down
2 changes: 1 addition & 1 deletion utils/generate.nix
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ in
manager = { };
}
```
Everything except for dnsConfig is a 1:1 map of the octodns config yaml described in there docs.
Everything except for dnsConfig is a 1:1 map of the octodns config yaml described in their docs.
*/
octodnsConfig =
# The required config
Expand Down
4 changes: 2 additions & 2 deletions utils/octodns.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
It won't actually be used by anything.
But the octodns bind module has a check for the validity of a zone-file
and a zone-file MUST have a SOA record.
Anyways, octodns will just ignore it's existence and only sync supported records.
Anyways, octodns will just ignore its existence and only sync supported records.

Type:
utils.octodns.fakeSOA :: Attr -> Attr
Expand Down Expand Up @@ -55,7 +55,7 @@
providers = {
config = {
class = "octodns_bind.ZoneFileSource";
# get's overwritten at the build step
# gets overwritten at the build step
directory = null;
# by default the files are supposed to be called `$zone.` this makes it so it's only `$zone`
file_extension = "";
Expand Down