This commit is contained in:
silver 2024-01-27 21:32:34 +00:00
commit 589ae332e6
3 changed files with 106 additions and 43 deletions

View file

@ -78,6 +78,7 @@ sync_repos:
- secrets/**/* - secrets/**/*
- flake.* - flake.*
- .gitlab-ci.yml - .gitlab-ci.yml
- config/**/*
# deploy items only run on main # deploy items only run on main
.deploy_template: &deployment .deploy_template: &deployment
@ -92,6 +93,7 @@ sync_repos:
- applications/**/* - applications/**/*
- machines/**/* - machines/**/*
- secrets/**/* - secrets/**/*
- config/**/*
linter: linter:
<<: *builder <<: *builder

View file

@ -240,47 +240,49 @@
old = ""; old = "";
}; };
records = builtins.concatLists ( records =
lib.attrsets.mapAttrsToList ( config.skynet.records
key: value: let ++ builtins.concatLists (
details_server = value.config.skynet_dns.server; lib.attrsets.mapAttrsToList (
details_records = value.config.skynet_dns.records; key: value: let
in details_server = value.config.skynet_dns.server;
if builtins.hasAttr "skynet_dns" value.config details_records = value.config.skynet_dns.records;
then in
( if builtins.hasAttr "skynet_dns" value.config
# got to handle habing a dns record for the dns serves themselves. then
if details_server.enable (
then # got to handle habing a dns record for the dns serves themselves.
( if details_server.enable
if details_server.primary then
then (
details_records if details_server.primary
++ [ then
{ details_records
record = "ns1"; ++ [
r_type = "A"; {
value = details_server.ip; record = "ns1";
server = false; r_type = "A";
} value = details_server.ip;
] server = false;
else }
details_records ]
++ [ else
{ details_records
record = "ns2"; ++ [
r_type = "A"; {
value = details_server.ip; record = "ns2";
server = false; r_type = "A";
} value = details_server.ip;
] server = false;
) }
else details_records ]
) )
else [] else details_records
) )
nodes else []
); )
nodes
);
nameserver = nameserver =
if cfg.server.primary if cfg.server.primary
@ -288,7 +290,8 @@
else "ns2"; else "ns2";
in { in {
imports = [ imports = [
../applications/firewall.nix ./firewall.nix
../config/dns.nix
]; ];
options = { options = {
@ -313,6 +316,7 @@ in {
}; };
}; };
# mirrorred in ../config/dns.nix
records = lib.mkOption { records = lib.mkOption {
description = "Records, sorted based on therir type"; description = "Records, sorted based on therir type";
type = with lib.types; type = with lib.types;

57
config/dns.nix Normal file
View file

@ -0,0 +1,57 @@
{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 = "optimus-reborn";
r_type = "A";
value = "193.1.99.90";
server = true;
}
{
record = "panel.games";
r_type = "CNAME";
value = "optimus-reborn";
}
#{
# record = "bumblebee";
# r_type = "A";
# value = "193.1.99.91";
# server = true;
#}
#{
# record = "testing";
# r_type = "CNAME";
# value = "bumblebee";
#}
];
};
}