From e73d473488ed106a5d24268c29654f7ebaa963e7 Mon Sep 17 00:00:00 2001 From: Mikael Voss Date: Tue, 12 Nov 2024 20:58:46 +0100 Subject: [PATCH] nixos/magi: Add basic NTP configuration --- nixos/config/balthasar.nix | 6 ++++++ nixos/config/casper.nix | 6 ++++++ nixos/config/melchior.nix | 6 ++++++ nixos/module/magi.nix | 24 ++++++++++++++++++++++++ 4 files changed, 42 insertions(+) diff --git a/nixos/config/balthasar.nix b/nixos/config/balthasar.nix index 622e5e4..353bff9 100644 --- a/nixos/config/balthasar.nix +++ b/nixos/config/balthasar.nix @@ -1,3 +1,9 @@ { self, ... }: { lib, config, pkgs, ... }: { imports = with self.nixosModules; [ magi ]; + + services.ntpd-rs.settings.source = map (address: { + mode = "server"; + inherit address; + }) [ "casper.nyantec.com" "melchior.nyantec.com" ] + |> lib.mkAfter; } diff --git a/nixos/config/casper.nix b/nixos/config/casper.nix index d795d69..abff8d5 100644 --- a/nixos/config/casper.nix +++ b/nixos/config/casper.nix @@ -9,4 +9,10 @@ fsType = "vfat"; }; }; + + services.ntpd-rs.settings.source = map (address: { + mode = "server"; + inherit address; + }) [ "melchior.nyantec.com" "balthasar.nyantec.com" ] + |> lib.mkAfter; } diff --git a/nixos/config/melchior.nix b/nixos/config/melchior.nix index 622e5e4..d2d243e 100644 --- a/nixos/config/melchior.nix +++ b/nixos/config/melchior.nix @@ -1,3 +1,9 @@ { self, ... }: { lib, config, pkgs, ... }: { imports = with self.nixosModules; [ magi ]; + + services.ntpd-rs.settings.source = map (address: { + mode = "server"; + inherit address; + }) [ "casper.nyantec.com" "balthasar.nyantec.com" ] + |> lib.mkAfter; } diff --git a/nixos/module/magi.nix b/nixos/module/magi.nix index dd31743..a412a42 100644 --- a/nixos/module/magi.nix +++ b/nixos/module/magi.nix @@ -132,4 +132,28 @@ ]; }; }; + + services.ntpd-rs = { + enable = true; + settings = { + source = map (n: { + mode = "server"; + address = "ptbtime${toString n}.ptb.de"; + }) (lib.range 1 4) ++ [ + { + mode = "server"; + address = "alucard.nyantec.com"; + } + ]; + + server = [ + { + listen = "[::]:123"; + } + { + listen = "0.0.0.0:123"; + } + ]; + }; + }; }