services: ntp: Document 'ntp-service-type' and 'ntp-configuration'.

* gnu/services/networking.scm (<ntp-configuration>)[servers]: Add
default value.
(ntp-service-type)[default-value]: New field.
(ntp-service): Mark as deprecated.
* gnu/services/desktop.scm (%desktop-services): Use (service
ntp-service-type) instead of calling 'ntp-service'.
* doc/guix.texi (Networking Services): Document 'ntp-service-type' and
'ntp-configuration'.
This commit is contained in:
Ludovic Courtès 2018-10-19 22:46:23 +02:00
parent bc83b2e22f
commit 64791eb7e1
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
3 changed files with 35 additions and 16 deletions

View File

@ -11817,20 +11817,37 @@ objects}).
@end table @end table
@end deftp @end deftp
@cindex NTP @cindex NTP (Network Time Protocol), service
@cindex real time clock @cindex real time clock
@deffn {Scheme Procedure} ntp-service [#:ntp @var{ntp}] @ @defvr {Scheme Variable} ntp-service-type
[#:servers @var{%ntp-servers}] @ This is the type of the service running the the @uref{http://www.ntp.org,
[#:allow-large-adjustment? #f] Network Time Protocol (NTP)} daemon, @command{ntpd}. The daemon will keep the
Return a service that runs the daemon from @var{ntp}, the system clock synchronized with that of the specified NTP servers.
@uref{http://www.ntp.org, Network Time Protocol package}. The daemon will
keep the system clock synchronized with that of @var{servers}. The value of this service is an @code{ntpd-configuration} object, as described
@var{allow-large-adjustment?} determines whether @command{ntpd} is allowed to below.
make an initial adjustment of more than 1,000 seconds. @end defvr
@end deffn
@deftp {Data Type} ntp-configuration
This is the data type for the NTP service configuration.
@table @asis
@item @code{servers} (default: @code{%ntp-servers})
This is the list of servers (host names) with which @command{ntpd} will be
synchronized.
@item @code{allow-large-adjustment?} (default: @code{#f})
This determines whether @command{ntpd} is allowed to make an initial
adjustment of more than 1,000 seconds.
@item @code{ntp} (default: @code{ntp})
The NTP package to use.
@end table
@end deftp
@defvr {Scheme Variable} %ntp-servers @defvr {Scheme Variable} %ntp-servers
List of host names used as the default NTP servers. List of host names used as the default NTP servers. These are servers of the
@uref{https://www.ntppool.org/en/, NTP Pool Project}.
@end defvr @end defvr
@cindex OpenNTPD @cindex OpenNTPD

View File

@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU ;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2014, 2015, 2016, 2017 Ludovic Courtès <ludo@gnu.org> ;;; Copyright © 2014, 2015, 2016, 2017, 2018 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2015 Andy Wingo <wingo@igalia.com> ;;; Copyright © 2015 Andy Wingo <wingo@igalia.com>
;;; Copyright © 2015 Mark H Weaver <mhw@netris.org> ;;; Copyright © 2015 Mark H Weaver <mhw@netris.org>
;;; Copyright © 2016 Sou Bunnbu <iyzsong@gmail.com> ;;; Copyright © 2016 Sou Bunnbu <iyzsong@gmail.com>
@ -996,7 +996,7 @@ as expected.")))
(elogind-service) (elogind-service)
(dbus-service) (dbus-service)
(ntp-service) (service ntp-service-type)
x11-socket-directory-service x11-socket-directory-service

View File

@ -297,7 +297,8 @@ Protocol (DHCP) client, on all the non-loopback network interfaces."
ntp-configuration? ntp-configuration?
(ntp ntp-configuration-ntp (ntp ntp-configuration-ntp
(default ntp)) (default ntp))
(servers ntp-configuration-servers) (servers ntp-configuration-servers
(default %ntp-servers))
(allow-large-adjustment? ntp-allow-large-adjustment? (allow-large-adjustment? ntp-allow-large-adjustment?
(default #f))) (default #f)))
@ -370,9 +371,10 @@ restrict -6 ::1\n"))
(description (description
"Run the @command{ntpd}, the Network Time Protocol (NTP) "Run the @command{ntpd}, the Network Time Protocol (NTP)
daemon of the @uref{http://www.ntp.org, Network Time Foundation}. The daemon daemon of the @uref{http://www.ntp.org, Network Time Foundation}. The daemon
will keep the system clock synchronized with that of the given servers."))) will keep the system clock synchronized with that of the given servers.")
(default-value (ntp-configuration))))
(define* (ntp-service #:key (ntp ntp) (define* (ntp-service #:key (ntp ntp) ;deprecated
(servers %ntp-servers) (servers %ntp-servers)
allow-large-adjustment?) allow-large-adjustment?)
"Return a service that runs the daemon from @var{ntp}, the "Return a service that runs the daemon from @var{ntp}, the