aboutsummaryrefslogtreecommitdiffstats
path: root/zones/default.nix
blob: dc3eb9f0e1315121e508ed6155bd441e3a9f588e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
{lib, ...}: let
  /*
  Computes a reasonable value for the DNS serial number from the date of last change
  and the iteration of that day.

  # Type

  mkSerial :: Number -> Number -> Number -> Number -> Number

  # Arguments

  year
  : The year of the last change in the format YYYY.

  month
  : The month of the last change in the format MM.

  day
  : The day of the last change in the format DD.

  iteration
  : The number of change on that day. The format should be CC (assuming there are less
    than 100 changes happening on a day) .

  # Examples

  mkSerial 2025 04 01 01
  => 2025040101
  */
  mkSerial = year: month: day: iteration: let
    n2 = lib.strings.fixedWidthNumber 2;
    n4 = lib.strings.fixedWidthNumber 4;
  in
    lib.strings.toIntBase10 "${n4 year}${n2 month}${n2 day}${n2 iteration}";
in {
  "vhack.eu" = import ./vhack.eu/zone.nix {inherit mkSerial;};
  "j-schoeffel.de" = import ./j-schoeffel.de/zone.nix {inherit mkSerial;};
  "jaki-schoeffel.de" = import ./jaki-schoeffel.de/zone.nix {inherit mkSerial;};
  "jaki.li" = import ./jaki.li/zone.nix {inherit mkSerial;};
}