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> |
0073f442 | 6 | ;;; Copyright © 2016, 2017, 2018, 2022 Efraim Flashner <efraim@flashner.co.il> |
71127538 | 7 | ;;; Copyright © 2018–2021 Tobias Geerinckx-Rice <me@tobias.gr> |
f92cf9d3 | 8 | ;;; Copyright © 2019 Maxim Cournoyer <maxim.cournoyer@gmail.com> |
c1947a8c | 9 | ;;; Copyright © 2021 Marius Bakke <marius@gnu.org> |
76a9bad3 | 10 | ;;; Copyright © 2021 Brice Waegeneire <brice@waegenei.re> |
d99e12d2 JD |
11 | ;;; |
12 | ;;; This file is part of GNU Guix. | |
13 | ;;; | |
14 | ;;; GNU Guix is free software; you can redistribute it and/or modify it | |
15 | ;;; under the terms of the GNU General Public License as published by | |
16 | ;;; the Free Software Foundation; either version 3 of the License, or (at | |
17 | ;;; your option) any later version. | |
18 | ;;; | |
19 | ;;; GNU Guix is distributed in the hope that it will be useful, but | |
20 | ;;; WITHOUT ANY WARRANTY; without even the implied warranty of | |
21 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
22 | ;;; GNU General Public License for more details. | |
23 | ;;; | |
24 | ;;; You should have received a copy of the GNU General Public License | |
25 | ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. | |
26 | ||
27 | (define-module (gnu packages ntp) | |
28 | #:use-module (gnu packages) | |
4b163550 | 29 | #:use-module (gnu packages autotools) |
ce0614dd | 30 | #:use-module (gnu packages base) |
4b163550 | 31 | #:use-module (gnu packages libevent) |
52b321e9 | 32 | #:use-module (gnu packages linux) |
9f12e06b | 33 | #:use-module (gnu packages nettle) |
53a427cf | 34 | #:use-module (gnu packages pkg-config) |
9f12e06b | 35 | #:use-module (gnu packages readline) |
cc2b77df | 36 | #:use-module (gnu packages tls) |
4b163550 TGR |
37 | #:use-module (guix build-system gnu) |
38 | #:use-module (guix download) | |
39 | #:use-module (guix git-download) | |
53a427cf | 40 | #:use-module ((guix licenses) #:prefix l:) |
d99e12d2 | 41 | #:use-module (guix packages) |
53a427cf | 42 | #:use-module (guix utils) |
d99e12d2 JD |
43 | #:use-module (srfi srfi-1)) |
44 | ||
9f12e06b TGR |
45 | (define-public chrony |
46 | (package | |
47 | (name "chrony") | |
b329c213 | 48 | (version "4.2") |
9f12e06b TGR |
49 | (source |
50 | (origin | |
51 | (method url-fetch) | |
52 | (uri (string-append "https://download.tuxfamily.org/chrony/" | |
53 | "chrony-" version ".tar.gz")) | |
54 | (sha256 | |
b329c213 | 55 | (base32 "16nv90h73c99adh2bdrvlws1lhjsqfp6pfpnlprxd3ijbk8rygr7")))) |
9f12e06b TGR |
56 | (build-system gnu-build-system) |
57 | (arguments | |
58 | `(#:modules ((srfi srfi-26) | |
59 | (guix build utils) | |
60 | (guix build gnu-build-system)) | |
61 | #:configure-flags | |
62 | (list "--enable-scfilter" | |
63 | "--with-sendmail=sendmail" | |
64 | "--with-user=chrony") | |
65 | #:phases | |
66 | (modify-phases %standard-phases | |
67 | (add-after 'unpack 'stay-inside-out | |
68 | ;; Simply setting CHRONYVARDIR to something nonsensical at install | |
69 | ;; time would result in nonsense file names in man pages. | |
70 | (lambda _ | |
71 | (substitute* "Makefile.in" | |
b329c213 | 72 | (("mkdir -p \\$\\(DESTDIR\\)\\$\\(CHRONYVARDIR\\)") ":")))) |
9f12e06b TGR |
73 | (add-after 'install 'install-more-documentation |
74 | (lambda* (#:key outputs #:allow-other-keys) | |
75 | (let* ((out (assoc-ref outputs "out")) | |
76 | (doc (string-append out "/share/doc/" ,name "-" ,version))) | |
77 | (for-each (cut install-file <> doc) | |
78 | (list "README" "FAQ")) | |
b329c213 | 79 | (copy-recursively "examples" (string-append doc "/examples")))))))) |
9f12e06b | 80 | (native-inputs |
8394619b | 81 | (list pkg-config)) |
9f12e06b | 82 | (inputs |
8394619b | 83 | (list gnutls libcap libseccomp nettle)) |
9f12e06b TGR |
84 | (home-page "https://chrony.tuxfamily.org/") |
85 | (synopsis "System clock synchronisation service that speaks NTP") | |
86 | (description | |
87 | "Chrony keeps your system time accurate. It synchronises your computer's | |
88 | clock with @acronym{NTP, Network Time Protocol} servers, reference clocks such | |
89 | as GPS receivers, or even manual input of the correct time from a wristwatch. | |
90 | ||
91 | Chrony will determine the rate at which the computer gains or loses time, and | |
92 | compensate for it. It can also operate as an NTPv4 (RFC 5905) server and peer | |
93 | to tell time to other computers on the network. | |
94 | ||
95 | It's designed to perform well even under adverse conditions: congested | |
96 | networks, unreliable clocks drifting with changes in temperature, and devices | |
97 | or virtual machines that are frequently turned off and connect to the Internet | |
98 | for only a few minutes at a time. | |
99 | ||
100 | Typical accuracy when synchronised over the Internet is several milliseconds. | |
101 | On a local network this can reach tens of microseconds. With hardware | |
102 | time-stamping or reference clock, sub-microsecond accuracy is possible.") | |
103 | (license l:gpl2))) | |
104 | ||
d99e12d2 JD |
105 | (define-public ntp |
106 | (package | |
107 | (name "ntp") | |
bc332f07 | 108 | (version "4.2.8p15") |
d35de59b EF |
109 | (source |
110 | (origin | |
111 | (method url-fetch) | |
112 | (uri (list (string-append | |
bc332f07 TGR |
113 | "https://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-" |
114 | (version-major+minor version) | |
115 | "/ntp-" version ".tar.gz") | |
d35de59b | 116 | (string-append |
bc332f07 TGR |
117 | "http://archive.ntp.org/ntp4/ntp-" |
118 | (version-major+minor version) | |
119 | "/ntp-" version ".tar.gz"))) | |
d35de59b | 120 | (sha256 |
bc332f07 | 121 | (base32 "06cwhimm71safmwvp6nhxp6hvxsg62whnbgbgiflsqb8mgg40n7n")) |
c1947a8c MB |
122 | ;; Add an upstream patch to fix build with GCC 10. Taken from |
123 | ;; <https://bugs.ntp.org/show_bug.cgi?id=3688>. | |
124 | (patches (list (origin | |
125 | (method url-fetch) | |
126 | (uri "https://bugs.ntp.org/attachment.cgi?id=1760\ | |
127 | &action=diff&context=patch&collapsed=&headers=1&format=raw") | |
128 | (file-name "ntp-gcc-compat.patch") | |
129 | (sha256 | |
130 | (base32 | |
131 | "13d28sg45rflc7kqiv30asrhna8n69wlpwx16l65rravgpvp90h2"))))) | |
d35de59b EF |
132 | (modules '((guix build utils))) |
133 | (snippet | |
134 | '(begin | |
135 | ;; Remove the bundled copy of libevent, but we must keep | |
136 | ;; sntp/libevent/build-aux since configure.ac contains | |
137 | ;; AC_CONFIG_AUX_DIR([sntp/libevent/build-aux]) | |
138 | (rename-file "sntp/libevent/build-aux" | |
139 | "sntp/libevent:build-aux") | |
140 | (delete-file-recursively "sntp/libevent") | |
141 | (mkdir "sntp/libevent") | |
142 | (rename-file "sntp/libevent:build-aux" | |
143 | "sntp/libevent/build-aux") | |
144 | #t)))) | |
8394619b | 145 | (native-inputs (list which pkg-config)) |
52b321e9 | 146 | (inputs |
53a427cf | 147 | `(("openssl" ,openssl) |
a60cd281 | 148 | ("libevent" ,libevent) |
53a427cf MW |
149 | ;; Build with POSIX capabilities support on GNU/Linux. This allows 'ntpd' |
150 | ;; to run as non-root (when invoked with '-u'.) | |
151 | ,@(if (string-suffix? "-linux" | |
152 | (or (%current-target-system) (%current-system))) | |
9e1f5a26 | 153 | `(("libcap" ,libcap)) |
53a427cf | 154 | '()))) |
a60cd281 MW |
155 | (arguments |
156 | `(#:phases | |
157 | (modify-phases %standard-phases | |
158 | (add-after 'unpack 'disable-network-test | |
159 | (lambda _ | |
160 | (substitute* "tests/libntp/Makefile.in" | |
161 | (("test-decodenetnum\\$\\(EXEEXT\\) ") "")) | |
162 | #t))))) | |
d99e12d2 | 163 | (build-system gnu-build-system) |
e881752c | 164 | (synopsis "Real time clock synchronization system") |
d99e12d2 JD |
165 | (description "NTP is a system designed to synchronize the clocks of |
166 | computers over a network.") | |
53a427cf | 167 | (license (l:x11-style |
e4a9f135 | 168 | "https://www.eecis.udel.edu/~mills/ntp/html/copyright.html" |
d99e12d2 | 169 | "A non-copyleft free licence from the University of Delaware")) |
e4a9f135 | 170 | (home-page "https://www.ntp.org"))) |
4ee69624 TUBK |
171 | |
172 | (define-public openntpd | |
173 | (package | |
174 | (name "openntpd") | |
9faee1e6 | 175 | (version "6.8p1") |
4ee69624 TUBK |
176 | (source (origin |
177 | (method url-fetch) | |
4ee69624 | 178 | (uri (string-append |
198571b2 | 179 | "mirror://openbsd/OpenNTPD/openntpd-" version ".tar.gz")) |
4ee69624 TUBK |
180 | (sha256 |
181 | (base32 | |
9faee1e6 | 182 | "0ijsylc7a4jlpxsqa0jq1w1c7333id8pcakzl7a5749ria1xp0l5")))) |
4ee69624 | 183 | (build-system gnu-build-system) |
16718b67 | 184 | (arguments |
76a9bad3 BW |
185 | `(#:configure-flags |
186 | (let* ((libressl (assoc-ref %build-inputs "libressl")) | |
d65bd744 BW |
187 | (libressl-version ,(package-version |
188 | (car (assoc-ref (package-inputs this-package) | |
189 | "libressl"))))) | |
76a9bad3 BW |
190 | (list "--with-privsep-user=ntpd" |
191 | "--localstatedir=/var" | |
192 | (string-append "--with-cacert=" libressl | |
193 | "/share/libressl-" libressl-version | |
194 | "/cert.pem"))) | |
16718b67 EF |
195 | #:phases |
196 | (modify-phases %standard-phases | |
197 | (add-after 'unpack 'modify-install-locations | |
198 | (lambda _ | |
199 | ;; Don't try to create /var/run or /var/db | |
200 | (substitute* "src/Makefile.in" | |
201 | (("DESTDIR\\)\\$\\(localstatedir") "TMPDIR")) | |
202 | #t))))) | |
080e023d | 203 | (inputs |
8394619b | 204 | (list libressl)) ; enable TLS time constraints. See ntpd.conf(5). |
4ee69624 TUBK |
205 | (home-page "http://www.openntpd.org/") |
206 | (synopsis "NTP client and server by the OpenBSD Project") | |
207 | (description "OpenNTPD is the OpenBSD Project's implementation of a client | |
208 | and server for the Network Time Protocol. Its design goals include being | |
209 | secure, easy to configure, and accurate enough for most purposes, so it's more | |
210 | minimalist than ntpd.") | |
0073f442 EF |
211 | (properties |
212 | '((release-monitoring-url . "https://cdn.openbsd.org/pub/OpenBSD/OpenNTPD"))) | |
4ee69624 TUBK |
213 | ;; A few of the source files are under bsd-3. |
214 | (license (list l:isc l:bsd-3)))) |