1{
2 lib,
3 stdenv,
4 fetchurl,
5 pkg-config,
6 gnutls,
7 libedit,
8 texinfo,
9 libcap,
10 libseccomp,
11 pps-tools,
12 nixosTests,
13}:
14
15stdenv.mkDerivation rec {
16 pname = "chrony";
17 version = "4.7";
18
19 src = fetchurl {
20 url = "https://chrony-project.org/releases/${pname}-${version}.tar.gz";
21 hash = "sha256-wN5BqMBR5dMrEBtfcBS5jKl4sY5ZLzDOaEC21GAtlHs=";
22 };
23
24 outputs = [
25 "out"
26 "man"
27 ];
28
29 nativeBuildInputs = [ pkg-config ];
30
31 buildInputs = [
32 gnutls
33 libedit
34 texinfo
35 ]
36 ++ lib.optionals stdenv.hostPlatform.isLinux [
37 libcap
38 libseccomp
39 pps-tools
40 ];
41
42 configureFlags = [
43 "--enable-ntp-signd"
44 "--sbindir=$(out)/bin"
45 "--chronyrundir=/run/chrony"
46 ]
47 ++ lib.optional stdenv.hostPlatform.isLinux "--enable-scfilter";
48
49 patches = [
50 # Cleanup the installation script
51 ./makefile.patch
52 ];
53
54 postPatch = ''
55 patchShebangs test
56
57 # nts_ke_session unit test fails, so drop it.
58 # TODO: try again when updating?
59 rm test/unit/nts_ke_session.c
60 '';
61
62 enableParallelBuilding = true;
63 doCheck = true;
64
65 hardeningEnable = lib.optionals (!stdenv.hostPlatform.isDarwin) [ "pie" ];
66
67 passthru.tests = {
68 inherit (nixosTests) chrony chrony-ptp;
69 };
70
71 meta = {
72 description = "Sets your computer's clock from time servers on the Net";
73 homepage = "https://chrony-project.org/";
74 license = lib.licenses.gpl2Only;
75 platforms =
76 with lib.platforms;
77 builtins.concatLists [
78 linux
79 freebsd
80 netbsd
81 darwin
82 illumos
83 ];
84 maintainers = with lib.maintainers; [
85 thoughtpolice
86 vifino
87 ];
88
89 longDescription = ''
90 Chronyd is a daemon which runs in background on the system. It obtains
91 measurements via the network of the system clock’s offset relative to
92 time servers on other systems and adjusts the system time accordingly.
93 For isolated systems, the user can periodically enter the correct time by
94 hand (using Chronyc). In either case, Chronyd determines the rate at
95 which the computer gains or loses time, and compensates for this. Chronyd
96 implements the NTP protocol and can act as either a client or a server.
97
98 Chronyc provides a user interface to Chronyd for monitoring its
99 performance and configuring various settings. It can do so while running
100 on the same computer as the Chronyd instance it is controlling or a
101 different computer.
102 '';
103 };
104}