dns: autogenerate the serial with some funky nix magic

This commit is contained in:
Rouven Seifert 2024-04-17 23:45:28 +02:00
parent d14f499783
commit a1afdcbdd0
Signed by: rouven.seifert
GPG key ID: B95E8FE6B11C4D09

View file

@ -1,12 +1,13 @@
{ pkgs, lib, config, dns, ... }:
{ self, pkgs, lib, config, dns, ... }:
let
modulo = number: mod: (number - ((number / mod) * mod));
secondary = "185.181.104.96";
zonefile = with dns.lib.combinators; pkgs.writeText "rfive.de.zone.txt" (dns.lib.toString "rfive.de" {
TTL = 3600;
SOA = {
nameServer = "ns.rfive.de.";
adminEmail = "hostmaster@rfive.de";
serial = 2024041709;
serial = lib.strings.toInt (builtins.substring 0 8 self.sourceInfo.lastModifiedDate + toString ((modulo self.sourceInfo.lastModified 86400) / 864));
refresh = 10800;
retry = 3600;
expire = 604800;