summaryrefslogtreecommitdiffstats
path: root/pkgs/by-name/nt/ntp/package.nix
blob: e36dad33bf8074f63f9298e67397b1a276f88c4a (plain)
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
{
  stdenv,
  lib,
  fetchurl,
  autoreconfHook,
  openssl,
  perl,
  pps-tools,
  libcap,
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "ntp";
  version = "4.2.8p18";

  src = fetchurl {
    url = "https://archive.ntp.org/ntp4/ntp-${lib.versions.majorMinor finalAttrs.version}/ntp-${finalAttrs.version}.tar.gz";
    hash = "sha256-z4TF8/saKVKElCYk2CP/+mNBROCWz8T5lprJjvX0aOU=";
  };

  # fix for gcc-14 compile failure
  postPatch = ''
    substituteInPlace sntp/m4/openldap-thread-check.m4 \
      --replace-fail "pthread_detach(NULL)" "pthread_detach(pthread_self())"
  '';

  configureFlags = [
    "--sysconfdir=/etc"
    "--localstatedir=/var"
    "--with-openssl-libdir=${lib.getLib openssl}/lib"
    "--with-openssl-incdir=${openssl.dev}/include"
    "--enable-ignore-dns-errors"
    "--with-yielding-select=yes"
  ]
  ++ lib.optional stdenv.hostPlatform.isLinux "--enable-linuxcaps";

  nativeBuildInputs = [ autoreconfHook ];

  buildInputs = [
    openssl
    perl
  ]
  ++ lib.optionals stdenv.hostPlatform.isLinux [
    pps-tools
    libcap
  ];

  postInstall = ''
    rm -rf $out/share/doc
  '';

  meta = {
    homepage = "https://www.ntp.org/";
    description = "Implementation of the Network Time Protocol";
    license = lib.licenses.AND [
      lib.licenses.ntp
      lib.licenses.bsd2
    ];
    maintainers = with lib.maintainers; [ thoughtpolice ];
    platforms = lib.platforms.unix;
  };
})