nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 stdenv,
3 lib,
4 fetchurl,
5 autoreconfHook,
6 openssl,
7 perl,
8 pps-tools,
9 libcap,
10}:
11
12stdenv.mkDerivation (finalAttrs: {
13 pname = "ntp";
14 version = "4.2.8p18";
15
16 src = fetchurl {
17 url = "https://archive.ntp.org/ntp4/ntp-${lib.versions.majorMinor finalAttrs.version}/ntp-${finalAttrs.version}.tar.gz";
18 hash = "sha256-z4TF8/saKVKElCYk2CP/+mNBROCWz8T5lprJjvX0aOU=";
19 };
20
21 # fix for gcc-14 compile failure
22 postPatch = ''
23 substituteInPlace sntp/m4/openldap-thread-check.m4 \
24 --replace-fail "pthread_detach(NULL)" "pthread_detach(pthread_self())"
25 '';
26
27 configureFlags = [
28 "--sysconfdir=/etc"
29 "--localstatedir=/var"
30 "--with-openssl-libdir=${lib.getLib openssl}/lib"
31 "--with-openssl-incdir=${openssl.dev}/include"
32 "--enable-ignore-dns-errors"
33 "--with-yielding-select=yes"
34 ]
35 ++ lib.optional stdenv.hostPlatform.isLinux "--enable-linuxcaps";
36
37 nativeBuildInputs = [ autoreconfHook ];
38
39 buildInputs = [
40 openssl
41 perl
42 ]
43 ++ lib.optionals stdenv.hostPlatform.isLinux [
44 pps-tools
45 libcap
46 ];
47
48 postInstall = ''
49 rm -rf $out/share/doc
50 '';
51
52 meta = {
53 homepage = "https://www.ntp.org/";
54 description = "Implementation of the Network Time Protocol";
55 license = {
56 # very close to isc and bsd2
57 url = "https://www.eecis.udel.edu/~mills/ntp/html/copyright.html";
58 };
59 maintainers = with lib.maintainers; [ thoughtpolice ];
60 platforms = lib.platforms.unix;
61 };
62})