feat: Added functionality to have dns for non nixos servers

Closes #52
This commit is contained in:
silver 2024-01-27 18:53:49 +00:00
parent 80c6fac51a
commit ccf090b841
2 changed files with 92 additions and 42 deletions

View file

@ -240,7 +240,9 @@
old = "";
};
records = builtins.concatLists (
records =
config.skynet.records
++ builtins.concatLists (
lib.attrsets.mapAttrsToList (
key: value: let
details_server = value.config.skynet_dns.server;
@ -288,7 +290,8 @@
else "ns2";
in {
imports = [
../applications/firewall.nix
./firewall.nix
../config/dns.nix
];
options = {
@ -313,6 +316,7 @@ in {
};
};
# mirrorred in ../config/dns.nix
records = lib.mkOption {
description = "Records, sorted based on therir type";
type = with lib.types;

46
config/dns.nix Normal file
View file

@ -0,0 +1,46 @@
{lib, ...}: {
imports = [
# Paths to other modules.
# Compose this module out of smaller ones.
];
# this needs to mirror ../applications/dns.nix
options.skynet.records = lib.mkOption {
description = "Records, sorted based on therir type";
type = with lib.types;
listOf (submodule {
options = {
record = lib.mkOption {
type = str;
};
r_type = lib.mkOption {
type = enum ["A" "CNAME" "TXT" "PTR" "SRV" "MX"];
};
value = lib.mkOption {
type = str;
};
server = lib.mkOption {
description = "Core record for a server";
type = bool;
default = false;
};
};
});
};
config = {
skynet.records = [
#{
# record = "bumblebee";
# r_type = "A";
# value = "193.1.99.91";
# server = true;
#}
#{
# record = "testing";
# r_type = "CNAME";
# value = "bumblebee";
#}
];
};
}