ntp.scm 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. ;;; GNU Guix --- Functional package management for GNU
  2. ;;; Copyright © 2014 John Darrington <jmd@gnu.org>
  3. ;;; Copyright © 2014, 2015 Mark H Weaver <mhw@netris.org>
  4. ;;; Copyright © 2015 Taylan Ulrich Bayırlı/Kammer <taylanbayirli@gmail.com>
  5. ;;; Copyright © 2015 Ludovic Courtès <ludo@gnu.org>
  6. ;;; Copyright © 2016, 2017 Efraim Flashner <efraim@flashner.co.il>
  7. ;;;
  8. ;;; This file is part of GNU Guix.
  9. ;;;
  10. ;;; GNU Guix is free software; you can redistribute it and/or modify it
  11. ;;; under the terms of the GNU General Public License as published by
  12. ;;; the Free Software Foundation; either version 3 of the License, or (at
  13. ;;; your option) any later version.
  14. ;;;
  15. ;;; GNU Guix is distributed in the hope that it will be useful, but
  16. ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
  17. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. ;;; GNU General Public License for more details.
  19. ;;;
  20. ;;; You should have received a copy of the GNU General Public License
  21. ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
  22. (define-module (gnu packages ntp)
  23. #:use-module (gnu packages)
  24. #:use-module (gnu packages base)
  25. #:use-module (gnu packages linux)
  26. #:use-module (gnu packages autotools)
  27. #:use-module (gnu packages pkg-config)
  28. #:use-module (gnu packages tls)
  29. #:use-module (gnu packages libevent)
  30. #:use-module ((guix licenses) #:prefix l:)
  31. #:use-module (guix packages)
  32. #:use-module (guix utils)
  33. #:use-module (guix download)
  34. #:use-module (guix git-download)
  35. #:use-module (guix build-system gnu)
  36. #:use-module (srfi srfi-1))
  37. (define-public ntp
  38. (package
  39. (name "ntp")
  40. (version "4.2.8p10")
  41. (source
  42. (origin
  43. (method url-fetch)
  44. (uri (list (string-append
  45. "http://archive.ntp.org/ntp4/ntp-"
  46. (version-major+minor version)
  47. "/ntp-" version ".tar.gz")
  48. (string-append
  49. "https://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-"
  50. (version-major+minor version)
  51. "/ntp-" version ".tar.gz")))
  52. (sha256
  53. (base32
  54. "17xrk7gxrl3hgg0i73n8qm53knyh01lf0f3l1zx9x6r1cip3dlnx"))
  55. (modules '((guix build utils)))
  56. (snippet
  57. '(begin
  58. ;; Remove the bundled copy of libevent, but we must keep
  59. ;; sntp/libevent/build-aux since configure.ac contains
  60. ;; AC_CONFIG_AUX_DIR([sntp/libevent/build-aux])
  61. (rename-file "sntp/libevent/build-aux"
  62. "sntp/libevent:build-aux")
  63. (delete-file-recursively "sntp/libevent")
  64. (mkdir "sntp/libevent")
  65. (rename-file "sntp/libevent:build-aux"
  66. "sntp/libevent/build-aux")
  67. #t))))
  68. (native-inputs `(("which" ,which)
  69. ("pkg-config" ,pkg-config)))
  70. (inputs
  71. `(("openssl" ,openssl)
  72. ("libevent" ,libevent)
  73. ;; Build with POSIX capabilities support on GNU/Linux. This allows 'ntpd'
  74. ;; to run as non-root (when invoked with '-u'.)
  75. ,@(if (string-suffix? "-linux"
  76. (or (%current-target-system) (%current-system)))
  77. `(("libcap" ,libcap))
  78. '())))
  79. (arguments
  80. `(#:phases
  81. (modify-phases %standard-phases
  82. (add-after 'unpack 'disable-network-test
  83. (lambda _
  84. (substitute* "tests/libntp/Makefile.in"
  85. (("test-decodenetnum\\$\\(EXEEXT\\) ") ""))
  86. #t)))))
  87. (build-system gnu-build-system)
  88. (synopsis "Real time clock synchronization system")
  89. (description "NTP is a system designed to synchronize the clocks of
  90. computers over a network.")
  91. (license (l:x11-style
  92. "http://www.eecis.udel.edu/~mills/ntp/html/copyright.html"
  93. "A non-copyleft free licence from the University of Delaware"))
  94. (home-page "http://www.ntp.org")))
  95. (define-public openntpd
  96. (package
  97. (name "openntpd")
  98. (version "6.2p2")
  99. (source (origin
  100. (method url-fetch)
  101. (uri (string-append
  102. "mirror://openbsd/OpenNTPD/" name "-" version ".tar.gz"))
  103. (sha256
  104. (base32
  105. "1chghbh1bnwhxdgkqki51w94nwvlyj1a9q8716r4v2h0gc9s822q"))))
  106. (build-system gnu-build-system)
  107. (home-page "http://www.openntpd.org/")
  108. (synopsis "NTP client and server by the OpenBSD Project")
  109. (description "OpenNTPD is the OpenBSD Project's implementation of a client
  110. and server for the Network Time Protocol. Its design goals include being
  111. secure, easy to configure, and accurate enough for most purposes, so it's more
  112. minimalist than ntpd.")
  113. ;; A few of the source files are under bsd-3.
  114. (license (list l:isc l:bsd-3))))
  115. (define-public tlsdate
  116. (package
  117. (name "tlsdate")
  118. (version "0.0.13")
  119. (home-page "https://github.com/ioerror/tlsdate")
  120. (source (origin
  121. (method git-fetch)
  122. (uri (git-reference
  123. (commit (string-append "tlsdate-" version))
  124. (url home-page)))
  125. (sha256
  126. (base32
  127. "0w3v63qmbhpqlxjsvf4k3zp90k6mdzi8cdpgshan9iphy1f44xgl"))
  128. (file-name (string-append name "-" version "-checkout"))))
  129. (build-system gnu-build-system)
  130. (arguments
  131. '(#:phases (modify-phases %standard-phases
  132. (add-after 'unpack 'autogen
  133. (lambda _
  134. ;; The ancestor of 'SOURCE_DATE_EPOCH'; it contains the
  135. ;; date that is recorded in binaries. It must be a
  136. ;; "recent date" since it is used to detect bogus dates
  137. ;; received from servers.
  138. (setenv "COMPILE_DATE" (number->string 1450563040))
  139. (zero? (system* "sh" "autogen.sh")))))))
  140. (inputs `(("openssl" ,openssl)
  141. ("libevent" ,libevent)))
  142. (native-inputs `(("pkg-config" ,pkg-config)
  143. ("autoconf" ,autoconf)
  144. ("automake" ,automake)
  145. ("libtool" ,libtool)))
  146. (synopsis "Extract remote time from TLS handshakes")
  147. (description
  148. "@command{tlsdate} sets the local clock by securely connecting with TLS
  149. to remote servers and extracting the remote time out of the secure handshake.
  150. Unlike ntpdate, @command{tlsdate} uses TCP, for instance connecting to a
  151. remote HTTPS or TLS enabled service, and provides some protection against
  152. adversaries that try to feed you malicious time information.")
  153. (license l:bsd-3)))