Files
nixos/base/chrony.nix

58 lines
1.0 KiB
Nix

# Module: base/chrony
{
config,
lib,
pkgs,
pkgsUnstable,
inputs,
options,
...
}:
with lib;
let
cfg = config.chrony;
in
{
options.chrony = {
ntpServers = mkOption {
type = types.listOf types.str;
default = [
"0.us.pool.ntp.org"
"1.us.pool.ntp.org"
"2.us.pool.ntp.org"
"3.us.pool.ntp.org"
"time.cloudflare.com"
"time.nist.gov"
];
description = "List of addresses of NTP servers to use for chrony";
example = [
"time.cloudflare.com"
"time.google.com"
];
};
};
config = {
environment.systemPackages = [
pkgs.chrony
];
services.chrony = {
enable = true;
package = pkgsUnstable.chrony;
# A lot of the default servers don't support NTS
enableNTS = false;
enableRTCTrimming = false;
serverOption = "iburst";
servers = cfg.ntpServers;
extraConfig = ''
# node_timex_sync_status only gets set with rtcsync
rtcsync
'';
};
};
}