dns: go back to basically an earlier config
This commit is contained in:
parent
ec8b458d75
commit
d750b046d1
1 changed files with 9 additions and 17 deletions
|
@ -2,20 +2,9 @@
|
|||
let
|
||||
cfg = config.skynet_dns;
|
||||
|
||||
# writes current epoch to a file (will need to be fixed in 2038)
|
||||
current_date_path = pkgs.runCommand "current_date" {} "date '+%s' > $out";
|
||||
# reads that date to a string
|
||||
current_date = (lib.readFile current_date_path);
|
||||
# reads that date to a string (will need to be fixed in 2038)
|
||||
current_date = toString builtins.currentTime;
|
||||
|
||||
# get all the records as a string (used later in teh zone file)
|
||||
current_external = lib.strings.concatMapStrings (x: x + "\n") cfg.records.external;
|
||||
current_cname = lib.strings.concatMapStrings (x: x + "\n") cfg.records.cname;
|
||||
|
||||
# get a hash of these two (cut down into a more manageable size)
|
||||
current_hash = lib.substring 0 10 (builtins.hashString "md5" "${current_external}_${current_cname}");
|
||||
|
||||
# create a custom filepath
|
||||
current_file = "${current_date}_${current_hash}";
|
||||
in {
|
||||
options = {
|
||||
skynet_dns = {
|
||||
|
@ -141,13 +130,16 @@ in {
|
|||
|
||||
dnssec-policy default;
|
||||
inline-signing yes;
|
||||
|
||||
// for bumping the config
|
||||
// ${current_date}
|
||||
'';
|
||||
# really wish teh nixos config didnt use master/slave
|
||||
master = true;
|
||||
slaves = [ ];
|
||||
# need to write this to a file
|
||||
# using the date in it so it will trigger a restart
|
||||
file = "/etc/dns_custom/dns_zone_skynet_${current_file}";
|
||||
file = "/etc/dns_custom/dns_zone_skynet";
|
||||
# no leading whitespace for first line
|
||||
|
||||
};
|
||||
|
@ -163,7 +155,7 @@ in {
|
|||
environment.etc = {
|
||||
# Creates /etc/dns_custom/dns_zone_skynet
|
||||
|
||||
"dns_custom/dns_zone_skynet_${current_file}" = {
|
||||
"dns_custom/dns_zone_skynet" = {
|
||||
user = "named";
|
||||
group = "named";
|
||||
|
||||
|
@ -200,7 +192,7 @@ in {
|
|||
|
||||
; External addresses
|
||||
; ------------------------------------------
|
||||
${current_external}
|
||||
${lib.strings.concatMapStrings (x: x + "\n") cfg.records.external}
|
||||
|
||||
|
||||
; this is fixed for now
|
||||
|
@ -215,7 +207,7 @@ in {
|
|||
|
||||
; cname's
|
||||
; ------------------------------------------
|
||||
${current_cname}
|
||||
${lib.strings.concatMapStrings (x: x + "\n") cfg.records.cname}
|
||||
|
||||
'';
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue