diff options
author | Matthieu Coudron <mattator@gmail.com> | 2018-03-04 08:30:00 +0900 |
---|---|---|
committer | Matthieu Coudron <mattator@gmail.com> | 2018-05-08 19:15:57 +0900 |
commit | f5e169c608f738de2469af27770f9a95d60faf82 (patch) | |
tree | b8a15ea75c309eed71d39f25c16a5b97df38a2b9 /nixos | |
parent | 1d9330d63a5a30f4eb578eda7840be7b11ec6277 (diff) | |
download | nixlib-f5e169c608f738de2469af27770f9a95d60faf82.tar nixlib-f5e169c608f738de2469af27770f9a95d60faf82.tar.gz nixlib-f5e169c608f738de2469af27770f9a95d60faf82.tar.bz2 nixlib-f5e169c608f738de2469af27770f9a95d60faf82.tar.lz nixlib-f5e169c608f738de2469af27770f9a95d60faf82.tar.xz nixlib-f5e169c608f738de2469af27770f9a95d60faf82.tar.zst nixlib-f5e169c608f738de2469af27770f9a95d60faf82.zip |
openntpd: make -s flag work
after seeing `adjtime failed: Invalid argument` in my syslog, I tried using `ntpd -s` but it would trigger `/etc/ntpd.conf: No such file or directory` see https://github.com/NixOS/nixpkgs/issues/31885 Instead of running the daemon with a specific config file, use the standard file so that user are able to use the ntp executable without having to look for the current config file.
Diffstat (limited to 'nixos')
-rw-r--r-- | nixos/modules/services/networking/openntpd.nix | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/nixos/modules/services/networking/openntpd.nix b/nixos/modules/services/networking/openntpd.nix index 4bb9da54fe09..241038ca12ed 100644 --- a/nixos/modules/services/networking/openntpd.nix +++ b/nixos/modules/services/networking/openntpd.nix @@ -7,7 +7,7 @@ let package = pkgs.openntpd_nixos; - cfgFile = pkgs.writeText "openntpd.conf" '' + configFile = '' ${concatStringsSep "\n" (map (s: "server ${s}") cfg.servers)} ${cfg.extraConfig} ''; @@ -31,8 +31,8 @@ in type = with types; lines; default = ""; example = '' - listen on 127.0.0.1 - listen on ::1 + listen on 127.0.0.1 + listen on ::1 ''; description = '' Additional text appended to <filename>openntpd.conf</filename>. @@ -57,6 +57,8 @@ in # Add ntpctl to the environment for status checking environment.systemPackages = [ package ]; + environment.etc."ntpd.conf".text = configFile; + users.extraUsers = singleton { name = "ntp"; uid = config.ids.uids.ntp; @@ -71,7 +73,7 @@ in before = [ "time-sync.target" ]; after = [ "dnsmasq.service" "bind.service" "network-online.target" ]; serviceConfig = { - ExecStart = "${package}/sbin/ntpd -f ${cfgFile} -p ${pidFile} ${cfg.extraOptions}"; + ExecStart = "${package}/sbin/ntpd -p ${pidFile} ${cfg.extraOptions}"; Type = "forking"; PIDFile = pidFile; }; |