Commit | Line | Data |
---|---|---|
d99e12d2 | 1 | ;;; GNU Guix --- Functional package management for GNU |
53a427cf | 2 | ;;; Copyright © 2014 John Darrington <jmd@gnu.org> |
b7921ba5 | 3 | ;;; Copyright © 2014, 2015 Mark H Weaver <mhw@netris.org> |
4ee69624 | 4 | ;;; Copyright © 2015 Taylan Ulrich Bayırlı/Kammer <taylanbayirli@gmail.com> |
0927b5be | 5 | ;;; Copyright © 2015, 2018 Ludovic Courtès <ludo@gnu.org> |
16718b67 | 6 | ;;; Copyright © 2016, 2017, 2018 Efraim Flashner <efraim@flashner.co.il> |
0a8c2c98 | 7 | ;;; Copyright © 2018, 2019 Tobias Geerinckx-Rice <me@tobias.gr> |
f92cf9d3 | 8 | ;;; Copyright © 2019 Maxim Cournoyer <maxim.cournoyer@gmail.com> |
d99e12d2 JD |
9 | ;;; |
10 | ;;; This file is part of GNU Guix. | |
11 | ;;; | |
12 | ;;; GNU Guix is free software; you can redistribute it and/or modify it | |
13 | ;;; under the terms of the GNU General Public License as published by | |
14 | ;;; the Free Software Foundation; either version 3 of the License, or (at | |
15 | ;;; your option) any later version. | |
16 | ;;; | |
17 | ;;; GNU Guix is distributed in the hope that it will be useful, but | |
18 | ;;; WITHOUT ANY WARRANTY; without even the implied warranty of | |
19 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
20 | ;;; GNU General Public License for more details. | |
21 | ;;; | |
22 | ;;; You should have received a copy of the GNU General Public License | |
23 | ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. | |
24 | ||
25 | (define-module (gnu packages ntp) | |
26 | #:use-module (gnu packages) | |
ce0614dd | 27 | #:use-module (gnu packages base) |
52b321e9 | 28 | #:use-module (gnu packages linux) |
604d20a2 | 29 | #:use-module (gnu packages autotools) |
53a427cf | 30 | #:use-module (gnu packages pkg-config) |
cc2b77df | 31 | #:use-module (gnu packages tls) |
a60cd281 | 32 | #:use-module (gnu packages libevent) |
53a427cf | 33 | #:use-module ((guix licenses) #:prefix l:) |
d99e12d2 | 34 | #:use-module (guix packages) |
53a427cf | 35 | #:use-module (guix utils) |
d99e12d2 | 36 | #:use-module (guix download) |
604d20a2 | 37 | #:use-module (guix git-download) |
d99e12d2 JD |
38 | #:use-module (guix build-system gnu) |
39 | #:use-module (srfi srfi-1)) | |
40 | ||
41 | (define-public ntp | |
42 | (package | |
43 | (name "ntp") | |
0a8c2c98 | 44 | (version "4.2.8p13") |
d35de59b EF |
45 | (source |
46 | (origin | |
47 | (method url-fetch) | |
48 | (uri (list (string-append | |
49 | "http://archive.ntp.org/ntp4/ntp-" | |
50 | (version-major+minor version) | |
51 | "/ntp-" version ".tar.gz") | |
52 | (string-append | |
53 | "https://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-" | |
54 | (version-major+minor version) | |
55 | "/ntp-" version ".tar.gz"))) | |
56 | (sha256 | |
0a8c2c98 | 57 | (base32 "0f1a4fya7v5s0426nim8ydvvlcashb8hicgs9xlm76ndrz7751r8")) |
d35de59b EF |
58 | (modules '((guix build utils))) |
59 | (snippet | |
60 | '(begin | |
61 | ;; Remove the bundled copy of libevent, but we must keep | |
62 | ;; sntp/libevent/build-aux since configure.ac contains | |
63 | ;; AC_CONFIG_AUX_DIR([sntp/libevent/build-aux]) | |
64 | (rename-file "sntp/libevent/build-aux" | |
65 | "sntp/libevent:build-aux") | |
66 | (delete-file-recursively "sntp/libevent") | |
67 | (mkdir "sntp/libevent") | |
68 | (rename-file "sntp/libevent:build-aux" | |
69 | "sntp/libevent/build-aux") | |
70 | #t)))) | |
53a427cf MW |
71 | (native-inputs `(("which" ,which) |
72 | ("pkg-config" ,pkg-config))) | |
52b321e9 | 73 | (inputs |
53a427cf | 74 | `(("openssl" ,openssl) |
a60cd281 | 75 | ("libevent" ,libevent) |
53a427cf MW |
76 | ;; Build with POSIX capabilities support on GNU/Linux. This allows 'ntpd' |
77 | ;; to run as non-root (when invoked with '-u'.) | |
78 | ,@(if (string-suffix? "-linux" | |
79 | (or (%current-target-system) (%current-system))) | |
80 | `(("libcap" ,libcap)) | |
81 | '()))) | |
a60cd281 MW |
82 | (arguments |
83 | `(#:phases | |
84 | (modify-phases %standard-phases | |
85 | (add-after 'unpack 'disable-network-test | |
86 | (lambda _ | |
87 | (substitute* "tests/libntp/Makefile.in" | |
88 | (("test-decodenetnum\\$\\(EXEEXT\\) ") "")) | |
89 | #t))))) | |
d99e12d2 | 90 | (build-system gnu-build-system) |
e881752c | 91 | (synopsis "Real time clock synchronization system") |
d99e12d2 JD |
92 | (description "NTP is a system designed to synchronize the clocks of |
93 | computers over a network.") | |
53a427cf | 94 | (license (l:x11-style |
d99e12d2 JD |
95 | "http://www.eecis.udel.edu/~mills/ntp/html/copyright.html" |
96 | "A non-copyleft free licence from the University of Delaware")) | |
97 | (home-page "http://www.ntp.org"))) | |
4ee69624 TUBK |
98 | |
99 | (define-public openntpd | |
100 | (package | |
101 | (name "openntpd") | |
6dbad376 | 102 | (version "6.2p3") |
4ee69624 TUBK |
103 | (source (origin |
104 | (method url-fetch) | |
4ee69624 | 105 | (uri (string-append |
644e5f17 | 106 | "mirror://openbsd/OpenNTPD/" name "-" version ".tar.gz")) |
4ee69624 TUBK |
107 | (sha256 |
108 | (base32 | |
6dbad376 | 109 | "0fn12i4kzsi0zkr4qp3dp9bycmirnfapajqvdfx02zhr4hanj0kv")))) |
4ee69624 | 110 | (build-system gnu-build-system) |
16718b67 | 111 | (arguments |
f92cf9d3 MC |
112 | '(#:configure-flags `( "--with-privsep-user=ntpd" |
113 | "--localstatedir=/var" | |
114 | ,(string-append "--with-cacert=" | |
115 | (assoc-ref %build-inputs "libressl") | |
116 | "/etc/ssl/cert.pem")) | |
16718b67 EF |
117 | #:phases |
118 | (modify-phases %standard-phases | |
119 | (add-after 'unpack 'modify-install-locations | |
120 | (lambda _ | |
121 | ;; Don't try to create /var/run or /var/db | |
122 | (substitute* "src/Makefile.in" | |
123 | (("DESTDIR\\)\\$\\(localstatedir") "TMPDIR")) | |
124 | #t))))) | |
080e023d LF |
125 | (inputs |
126 | `(("libressl" ,libressl))) ; enable TLS time constraints. See ntpd.conf(5). | |
4ee69624 TUBK |
127 | (home-page "http://www.openntpd.org/") |
128 | (synopsis "NTP client and server by the OpenBSD Project") | |
129 | (description "OpenNTPD is the OpenBSD Project's implementation of a client | |
130 | and server for the Network Time Protocol. Its design goals include being | |
131 | secure, easy to configure, and accurate enough for most purposes, so it's more | |
132 | minimalist than ntpd.") | |
133 | ;; A few of the source files are under bsd-3. | |
134 | (license (list l:isc l:bsd-3)))) | |
604d20a2 LC |
135 | |
136 | (define-public tlsdate | |
137 | (package | |
138 | (name "tlsdate") | |
139 | (version "0.0.13") | |
140 | (home-page "https://github.com/ioerror/tlsdate") | |
141 | (source (origin | |
142 | (method git-fetch) | |
143 | (uri (git-reference | |
144 | (commit (string-append "tlsdate-" version)) | |
145 | (url home-page))) | |
146 | (sha256 | |
147 | (base32 | |
148 | "0w3v63qmbhpqlxjsvf4k3zp90k6mdzi8cdpgshan9iphy1f44xgl")) | |
149 | (file-name (string-append name "-" version "-checkout")))) | |
150 | (build-system gnu-build-system) | |
151 | (arguments | |
0927b5be LC |
152 | `(;; Disable seccomp when it's not supported--e.g., on aarch64. See |
153 | ;; 'src/seccomp.c' for the list of supported systems. | |
154 | #:configure-flags ,(if (any (lambda (system) | |
155 | (string-contains (or | |
156 | (%current-target-system) | |
157 | (%current-system)) | |
158 | system)) | |
159 | '("x86_64" "i686" "arm")) | |
160 | ''() | |
161 | ''("--disable-seccomp-filter")) | |
162 | ||
163 | #:phases (modify-phases %standard-phases | |
604d20a2 LC |
164 | (add-after 'unpack 'autogen |
165 | (lambda _ | |
166 | ;; The ancestor of 'SOURCE_DATE_EPOCH'; it contains the | |
167 | ;; date that is recorded in binaries. It must be a | |
168 | ;; "recent date" since it is used to detect bogus dates | |
169 | ;; received from servers. | |
23256858 | 170 | (setenv "COMPILE_DATE" (number->string 1530144000)) |
efc1fd32 | 171 | (invoke "sh" "autogen.sh")))))) |
4ecf790e | 172 | (inputs `(("openssl" ,openssl-1.0) |
604d20a2 LC |
173 | ("libevent" ,libevent))) |
174 | (native-inputs `(("pkg-config" ,pkg-config) | |
175 | ("autoconf" ,autoconf) | |
176 | ("automake" ,automake) | |
177 | ("libtool" ,libtool))) | |
178 | (synopsis "Extract remote time from TLS handshakes") | |
179 | (description | |
180 | "@command{tlsdate} sets the local clock by securely connecting with TLS | |
181 | to remote servers and extracting the remote time out of the secure handshake. | |
182 | Unlike ntpdate, @command{tlsdate} uses TCP, for instance connecting to a | |
183 | remote HTTPS or TLS enabled service, and provides some protection against | |
184 | adversaries that try to feed you malicious time information.") | |
185 | (license l:bsd-3))) |