| 1 | |
| 2 | |
| 3 | |
| 4 | |
| 5 | |
| 6 | |
| 7 | |
| 8 | |
| 9 | |
| 10 | |
| 11 | |
| 12 | |
| 13 | |
| 14 | |
| 15 | |
| 16 | |
| 17 | |
| 18 | |
| 19 | |
| 20 | |
| 21 | |
| 22 | |
| 23 | |
| 24 | |
| 25 | |
| 26 | |
| 27 | |
| 28 | |
| 29 | |
| 30 | |
| 31 |
|
| 32 | (define-module (gnu packages ntp)
|
| 33 | #:use-module (gnu packages)
|
| 34 | #:use-module (gnu packages autotools)
|
| 35 | #:use-module (gnu packages base)
|
| 36 | #:use-module (gnu packages bison)
|
| 37 | #:use-module (gnu packages build-tools)
|
| 38 | #:use-module (gnu packages gps)
|
| 39 | #:use-module (gnu packages guile)
|
| 40 | #:use-module (gnu packages libevent)
|
| 41 | #:use-module (gnu packages linux)
|
| 42 | #:use-module (gnu packages m4)
|
| 43 | #:use-module (gnu packages nettle)
|
| 44 | #:use-module (gnu packages perl)
|
| 45 | #:use-module (gnu packages pkg-config)
|
| 46 | #:use-module (gnu packages python)
|
| 47 | #:use-module (gnu packages python-xyz)
|
| 48 | #:use-module (gnu packages readline)
|
| 49 | #:use-module (gnu packages ruby-xyz)
|
| 50 | #:use-module (gnu packages time)
|
| 51 | #:use-module (gnu packages tls)
|
| 52 | #:use-module (gnu packages web)
|
| 53 | #:use-module (guix build-system gnu)
|
| 54 | #:use-module (guix build-system waf)
|
| 55 | #:use-module (guix download)
|
| 56 | #:use-module (guix gexp)
|
| 57 | #:use-module (guix git-download)
|
| 58 | #:use-module ((guix licenses) #:prefix l:)
|
| 59 | #:use-module (guix packages)
|
| 60 | #:use-module (guix utils)
|
| 61 | #:use-module (srfi srfi-1))
|
| 62 |
|
| 63 | (define-public chrony
|
| 64 | (package
|
| 65 | (name "chrony")
|
| 66 | (version "4.8")
|
| 67 | (source
|
| 68 | (origin
|
| 69 | (method git-fetch)
|
| 70 | (uri (git-reference
|
| 71 | (url "https://gitlab.com/chrony/chrony.git/")
|
| 72 | (commit version)))
|
| 73 | (file-name (git-file-name name version))
|
| 74 | (sha256
|
| 75 | (base32 "0pw1c6wkm4pxc92m1ykxs467azk6gmhvb8m49qkzw0s0agpg49nm"))))
|
| 76 | (build-system gnu-build-system)
|
| 77 | (arguments
|
| 78 | (list
|
| 79 | #:modules
|
| 80 | '((srfi srfi-26)
|
| 81 | (guix build utils)
|
| 82 | (guix build gnu-build-system))
|
| 83 | #:configure-flags
|
| 84 | #~(list "--enable-scfilter"
|
| 85 | "--with-ntp-era=0"
|
| 86 | "--with-sendmail=sendmail"
|
| 87 | "--with-user=chrony")
|
| 88 | #:phases
|
| 89 | #~(modify-phases %standard-phases
|
| 90 | (add-after 'unpack 'set-CC
|
| 91 | (lambda _
|
| 92 | (setenv "CC" #$(cc-for-target))))
|
| 93 | #$@(if (this-package-native-input "ruby-asciidoctor")
|
| 94 | #~()
|
| 95 | #~((add-after 'unpack 'adjust-makefile
|
| 96 | (lambda _
|
| 97 | (substitute* "doc/Makefile.in"
|
| 98 | (("install:")
|
| 99 | (string-append "install:\n\n"
|
| 100 | "not-install:")))))))
|
| 101 | (add-after 'unpack 'stay-inside-out
|
| 102 | |
| 103 | |
| 104 | (lambda _
|
| 105 | (substitute* "Makefile.in"
|
| 106 | (("mkdir -p \\$\\(DESTDIR\\)\\$\\(CHRONYVARDIR\\)") ":"))))
|
| 107 | (add-after 'install 'install-more-documentation
|
| 108 | (lambda _
|
| 109 | (let* ((doc (string-append #$output "/share/doc/"
|
| 110 | #$name "-" #$version)))
|
| 111 | (for-each (cut install-file <> doc)
|
| 112 | (list "README"))
|
| 113 | (copy-recursively "examples"
|
| 114 | (string-append doc "/examples"))))))))
|
| 115 | (native-inputs
|
| 116 | (append (list bison
|
| 117 | pkg-config)
|
| 118 | (if (supported-package? ruby-asciidoctor/minimal)
|
| 119 | (list ruby-asciidoctor/minimal)
|
| 120 | '())))
|
| 121 | (inputs
|
| 122 | (list gnutls libcap libseccomp nettle))
|
| 123 | (home-page "https://chrony-project.org/")
|
| 124 | (synopsis "System clock synchronization service that speaks NTP")
|
| 125 | (description
|
| 126 | "Chrony keeps your system time accurate. It synchronises your computer's
|
| 127 | clock with @acronym{NTP, Network Time Protocol} servers, reference clocks such
|
| 128 | as GPS receivers, or even manual input of the correct time from a wristwatch.
|
| 129 |
|
| 130 | Chrony will determine the rate at which the computer gains or loses time, and
|
| 131 | compensate for it. It can also operate as an
|
| 132 | NTPv4 (@url{https://www.rfc-editor.org/rfc/rfc5905, RFC 5905}) server and peer to
|
| 133 | tell time to other computers on the network.
|
| 134 |
|
| 135 | It's designed to perform well even under adverse conditions: congested
|
| 136 | networks, unreliable clocks drifting with changes in temperature, and devices
|
| 137 | or virtual machines that are frequently turned off and connect to the Internet
|
| 138 | for only a few minutes at a time.
|
| 139 |
|
| 140 | Typical accuracy when synchronised over the Internet is several milliseconds.
|
| 141 | On a local network this can reach tens of microseconds. With hardware
|
| 142 | time-stamping or reference clock, sub-microsecond accuracy is possible.")
|
| 143 | (license l:gpl2)))
|
| 144 |
|
| 145 | (define-public ntp
|
| 146 | (package
|
| 147 | (name "ntp")
|
| 148 | (version "4.2.8p18")
|
| 149 | (source
|
| 150 | (origin
|
| 151 | (method url-fetch)
|
| 152 | (uri (list (string-append
|
| 153 | "https://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-"
|
| 154 | (version-major+minor version) "/ntp-" version ".tar.gz")
|
| 155 | (string-append "http://archive.ntp.org/ntp4/ntp-"
|
| 156 | (version-major+minor version) "/ntp-" version
|
| 157 | ".tar.gz")))
|
| 158 | (sha256
|
| 159 | (base32 "1rb8yksqxjcsjvww9kwnw1242qzszwixh916jj254a8szgrwb16g"))
|
| 160 | (patches (search-patches
|
| 161 | "ntp-fix-dereferencing-the-wrong-variable.patch"))
|
| 162 | (modules '((guix build utils)))
|
| 163 | (snippet '(begin
|
| 164 | |
| 165 | |
| 166 | |
| 167 | (rename-file "sntp/libevent/build-aux"
|
| 168 | "sntp/libevent:build-aux")
|
| 169 | (delete-file-recursively "sntp/libevent")
|
| 170 | (mkdir "sntp/libevent")
|
| 171 | (rename-file "sntp/libevent:build-aux"
|
| 172 | "sntp/libevent/build-aux")))))
|
| 173 | (native-inputs (list which pkg-config))
|
| 174 | (inputs (cons* guile-3.0 |
| 175 | libevent
|
| 176 | openssl-3.0
|
| 177 | perl
|
| 178 | perl-http-tiny
|
| 179 | perl-io-socket-ssl
|
| 180 | perl-net-ssleay
|
| 181 | |
| 182 | |
| 183 | (if (target-linux?)
|
| 184 | (list libcap)
|
| 185 | '())))
|
| 186 | (arguments
|
| 187 | (list
|
| 188 | |
| 189 | |
| 190 | #:configure-flags
|
| 191 | #~(list
|
| 192 | "CFLAGS=-g -O2 -Wno-error=int-conversion"
|
| 193 | "--with-yielding-select=yes")
|
| 194 | #:phases
|
| 195 | #~(modify-phases %standard-phases
|
| 196 | (add-after 'unpack 'disable-network-test
|
| 197 | (lambda _
|
| 198 | (substitute* "tests/libntp/Makefile.in"
|
| 199 | (("test-decodenetnum\\$\\(EXEEXT\\) ")
|
| 200 | ""))))
|
| 201 | (add-after 'unpack 'update-leap-file-source
|
| 202 | |
| 203 | (lambda _
|
| 204 | (substitute* '("scripts/update-leap/invoke-update-leap.texi"
|
| 205 | "scripts/update-leap/update-leap.in")
|
| 206 | (("https://www.ietf.org/timezones/data/leap-seconds.list")
|
| 207 | "https://data.iana.org/time-zones/data/leap-seconds.list"))))
|
| 208 | (add-after 'unpack 'use-absolute-path-in-files
|
| 209 | (lambda _
|
| 210 | (substitute* "scripts/lib/NTP/Util.pm"
|
| 211 | (("(ntpq_path = ')ntpq(';)" _ first last)
|
| 212 | (string-append first #$output "/bin/ntpq" last))
|
| 213 | (("(sntp_path = ')sntp(';)" _ first last)
|
| 214 | (string-append first #$output "/bin/sntp" last)))
|
| 215 | (substitute* "scripts/calc_tickadj/calc_tickadj.in"
|
| 216 | (("`tickadj`")
|
| 217 | (string-append "`" #$output "/bin/tickadj`")))))
|
| 218 | (add-after 'install 'adjust-scripts
|
| 219 | (lambda _
|
| 220 | (substitute* (string-append #$output "/bin/calc_tickadj")
|
| 221 | (("/etc/ntp/drift")
|
| 222 | "/var/run/ntpd/ntp.drift"))
|
| 223 | (wrap-script (string-append #$output "/bin/update-leap")
|
| 224 | `("PERL5LIB" ":" prefix
|
| 225 | (,(getenv "PERL5LIB")))))))))
|
| 226 | (build-system gnu-build-system)
|
| 227 | (synopsis "Real time clock synchronization system")
|
| 228 | (description "NTP is a system designed to synchronize the clocks of
|
| 229 | computers over a network.")
|
| 230 | (license (l:x11-style
|
| 231 | "https://www.eecis.udel.edu/~mills/ntp/html/copyright.html"
|
| 232 | "A non-copyleft free licence from the University of Delaware"))
|
| 233 | (home-page "https://www.ntp.org")))
|
| 234 |
|
| 235 | (define-public ntpsec
|
| 236 | (package
|
| 237 | (name "ntpsec")
|
| 238 | (version "1.2.4")
|
| 239 | (source
|
| 240 | (origin
|
| 241 | (method git-fetch)
|
| 242 | (uri (git-reference
|
| 243 | (url "https://gitlab.com/NTPsec/ntpsec.git")
|
| 244 | (commit (string-append "NTPsec_"
|
| 245 | (string-replace-substring version "." "_")))))
|
| 246 | (file-name (git-file-name name version))
|
| 247 | (sha256
|
| 248 | (base32 "1m23mzsj3iq36d14ncj0w74hy152blv61nxd8w4xcs52vsh48mps"))))
|
| 249 | (native-inputs (list bison
|
| 250 | m4
|
| 251 | pkg-config
|
| 252 | pps-tools
|
| 253 | waf
|
| 254 | ruby-asciidoctor/minimal))
|
| 255 | (inputs (cons* gpsd openssl
|
| 256 | |
| 257 | |
| 258 | (if (target-linux?)
|
| 259 | (list libcap libseccomp)
|
| 260 | '())))
|
| 261 | (arguments
|
| 262 | (list
|
| 263 | #:configure-flags
|
| 264 | #~(list "--refclock=all"
|
| 265 | "--enable-manpage"
|
| 266 | "--disable-doc"
|
| 267 | #$@(if (target-linux?)
|
| 268 | '("--enable-seccomp")
|
| 269 | '())
|
| 270 | "--enable-mssntp")
|
| 271 | #:phases
|
| 272 | #~(modify-phases %standard-phases
|
| 273 | (add-after 'unpack 'disable-network-test
|
| 274 | (lambda _
|
| 275 | (substitute* "tests/wscript"
|
| 276 | (("\"libntp/decodenetnum.c\",")
|
| 277 | ""))
|
| 278 | (substitute* "tests/common/tests_main.c"
|
| 279 | (("RUN_TEST_GROUP\\(decodenetnum\\);")
|
| 280 | ""))))
|
| 281 | |
| 282 | (add-before 'build 'symlink-python-gps
|
| 283 | (lambda* (#:key inputs #:allow-other-keys)
|
| 284 | (mkdir-p "build/main/tests/pylib")
|
| 285 | (let ((python-version #$(version-major+minor (package-version
|
| 286 | python))))
|
| 287 | (symlink (string-append (assoc-ref inputs "gpsd")
|
| 288 | "/lib/python" python-version
|
| 289 | "/site-packages/gps")
|
| 290 | "build/main/tests/pylib/gps")))))))
|
| 291 | (build-system waf-build-system)
|
| 292 | (synopsis "Real time clock synchronization system and utilities")
|
| 293 | (description
|
| 294 | "@acronym{NTP, Network Time Protocol}, the protocol, is used to keep
|
| 295 | computer clocks accurate by synchronizing them over the Internet or a
|
| 296 | local network, or by following an accurate hardware receiver that interprets
|
| 297 | GPS, DCF-77, or similar time signals.
|
| 298 |
|
| 299 | NTPsec is a hardened and improved implementation derived from the original
|
| 300 | @url{https://www.ntp.org, NTP project}. NTPsec supports
|
| 301 | @acronym{NTS, Network Time Security} which provides cryptographically
|
| 302 | authenticated time.
|
| 303 |
|
| 304 | This package contains the NTP daemon and utility programs. An NTP daemon
|
| 305 | needs to be running on each host that is to have its clock accuracy controlled
|
| 306 | by NTP. The same NTP daemon is also used to provide NTP service to other hosts.")
|
| 307 | |
| 308 | (license (list l:bsd-2
|
| 309 | l:bsd-3
|
| 310 | l:bsd-4
|
| 311 | l:isc
|
| 312 | l:expat
|
| 313 | l:asl2.0
|
| 314 | l:cc-by4.0
|
| 315 | (l:non-copyleft "file://LICENSES/Beerware.txt"
|
| 316 | "See LICENSES/Beerware.txt in the distribution.")
|
| 317 | (l:x11-style
|
| 318 | "https://www.eecis.udel.edu/~mills/ntp/html/copyright.html"
|
| 319 | "A non-copyleft free licence from the University of Delaware")))
|
| 320 | (home-page "https://www.ntpsec.org")))
|
| 321 |
|
| 322 | (define-public openntpd
|
| 323 | (package
|
| 324 | (name "openntpd")
|
| 325 | (version "7.2")
|
| 326 | (source
|
| 327 | (origin
|
| 328 | (method git-fetch)
|
| 329 | (uri (git-reference
|
| 330 | (url "https://github.com/openntpd-portable/openntpd-portable")
|
| 331 | (commit "cf202d14cb46d1b37638a13e7ed5c1d4143878fe")))
|
| 332 | (file-name (git-file-name name version))
|
| 333 | (sha256
|
| 334 | (base32 "1l7xp5yscdwc4llnb55z2k0vcw197qd9zcwb4gm2vi1m7an3aygx"))))
|
| 335 | (build-system gnu-build-system)
|
| 336 | (arguments
|
| 337 | `(#:modules ((srfi srfi-1)
|
| 338 | (guix build utils)
|
| 339 | (guix build gnu-build-system))
|
| 340 | #:configure-flags
|
| 341 | (let* ((libressl (assoc-ref %build-inputs "libressl"))
|
| 342 | (libressl-version ,(package-version
|
| 343 | (car (assoc-ref (package-inputs this-package)
|
| 344 | "libressl")))))
|
| 345 | (list "--with-privsep-user=ntpd"
|
| 346 | "--localstatedir=/var"
|
| 347 | (string-append "--with-cacert=" libressl
|
| 348 | "/share/libressl-" libressl-version
|
| 349 | "/cert.pem")))
|
| 350 | #:phases
|
| 351 | (modify-phases %standard-phases
|
| 352 | (add-after 'unpack 'copy-openbsd
|
| 353 | (lambda* (#:key inputs #:allow-other-keys)
|
| 354 | (mkdir-p "openbsd")
|
| 355 | (for-each
|
| 356 | (lambda (subdir)
|
| 357 | (copy-recursively |
| 358 | (in-vicinity (assoc-ref inputs "openbsd") subdir)
|
| 359 | (in-vicinity "openbsd/src" subdir)))
|
| 360 | |
| 361 | '("etc" "include" "lib/libc" "lib/libcrypto/arc4random"
|
| 362 | "lib/libutil" "usr.sbin/ntpd"))))
|
| 363 | |
| 364 | |
| 365 | (add-after 'unpack 'fix-update-script
|
| 366 | (lambda* (#:key inputs #:allow-other-keys)
|
| 367 | (substitute* "update.sh"
|
| 368 | |
| 369 | (("#!/bin/sh")
|
| 370 | (string-append
|
| 371 | "#!"
|
| 372 | (search-input-file inputs "/bin/sh")))
|
| 373 | |
| 374 | (("git") "true"))))
|
| 375 | (add-after 'unpack 'modify-install-locations
|
| 376 | (lambda _
|
| 377 | |
| 378 | (substitute* "src/Makefile.am"
|
| 379 | (("DESTDIR\\)\\$\\(localstatedir") "TMPDIR"))))
|
| 380 | |
| 381 | (add-after 'set-paths 'adjust-C_INCLUDE_PATH
|
| 382 | (lambda* (#:key inputs #:allow-other-keys)
|
| 383 | (let ((openbsd (assoc-ref inputs "openbsd")))
|
| 384 | (setenv "C_INCLUDE_PATH"
|
| 385 | (string-join
|
| 386 | (delete
|
| 387 | (string-append openbsd "/include")
|
| 388 | (string-split (getenv "C_INCLUDE_PATH") #\:))
|
| 389 | ":"))
|
| 390 | (format #t
|
| 391 | "environment variable `C_INCLUDE_PATH' changed to ~a~%"
|
| 392 | (getenv "C_INCLUDE_PATH"))))))))
|
| 393 | (inputs
|
| 394 | `(("openbsd"
|
| 395 | ,(origin
|
| 396 | (method git-fetch)
|
| 397 | (uri (git-reference
|
| 398 | (url "https://github.com/openbsd/src")
|
| 399 | |
| 400 | (commit "b3121f2f06d5822c63d53f93b0df3f0c846d8fce")))
|
| 401 | (file-name (git-file-name name version))
|
| 402 | (sha256
|
| 403 | (base32 "0dif6vcli9i7gx0aw93an9vk164729gayyfbm1z1w9hqvwq4r4dm"))))
|
| 404 | |
| 405 | ("libressl" ,libressl)))
|
| 406 | (native-inputs
|
| 407 | (list autoconf automake bison libtool))
|
| 408 | (home-page "https://www.openntpd.org/")
|
| 409 | (synopsis "NTP client and server by the OpenBSD Project")
|
| 410 | (description "OpenNTPD is the OpenBSD Project's implementation of a client
|
| 411 | and server for the Network Time Protocol. Its design goals include being
|
| 412 | secure, easy to configure, and accurate enough for most purposes, so it's more
|
| 413 | minimalist than ntpd.")
|
| 414 | |
| 415 | (license (list l:isc l:bsd-3))))
|