nixos/chrony: add option to choose between two commonly used server directive options

This commit is contained in:
Ctem
2021-01-06 20:04:41 +09:00
parent 9550d865e9
commit 2e131e1f45
@@ -10,7 +10,7 @@ let
keyFile = "${stateDir}/chrony.keys";
configFile = pkgs.writeText "chrony.conf" ''
${concatMapStringsSep "\n" (server: "server " + server + " iburst" + optionalString (cfg.enableNTS) " nts") cfg.servers}
${concatMapStringsSep "\n" (server: "server " + server + " " + cfg.serverOption + optionalString (cfg.enableNTS) " nts") cfg.servers}
${optionalString
(cfg.initstepslew.enabled && (cfg.servers != []))
@@ -47,6 +47,20 @@ in
'';
};
serverOption = mkOption {
default = "iburst";
type = types.enum [ "iburst" "offline" ];
description = ''
Set option for server directives.
Use "iburst" to rapidly poll on startup. Recommended if your machine
is consistently online.
Use "offline" to prevent polling on startup. Recommended if your
machine boots offline or is otherwise frequently offline.
'';
};
enableNTS = mkOption {
type = types.bool;
default = false;