1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 autoreconfHook,
6 pkg-config,
7 gnutls,
8 cunit,
9 ncurses,
10 knot-dns,
11}:
12
13stdenv.mkDerivation rec {
14 pname = "ngtcp2";
15 version = "1.14.0";
16
17 src = fetchFromGitHub {
18 owner = "ngtcp2";
19 repo = "ngtcp2";
20 rev = "v${version}";
21 hash = "sha256-TpfCfVhguFbTqQiY+zl6Kn7fsIQHR1tvNC4YLkxmBis=";
22 };
23
24 outputs = [
25 "out"
26 "dev"
27 ];
28
29 nativeBuildInputs = [
30 autoreconfHook
31 pkg-config
32 ];
33 buildInputs = [ gnutls ];
34
35 configureFlags = [ "--with-gnutls=yes" ];
36 enableParallelBuilding = true;
37
38 doCheck = true;
39 nativeCheckInputs = [ cunit ] ++ lib.optional stdenv.hostPlatform.isDarwin ncurses;
40
41 passthru.tests = knot-dns.passthru.tests; # the only consumer so far
42
43 meta = with lib; {
44 homepage = "https://github.com/ngtcp2/ngtcp2";
45 description = "Effort to implement RFC9000 QUIC protocol";
46 license = licenses.mit;
47 platforms = platforms.unix;
48 maintainers = with maintainers; [
49 vcunat # for knot-dns
50 ];
51 };
52}
53
54/*
55 Why split from ./default.nix?
56
57 ngtcp2 libs contain helpers to plug into various crypto libs (gnutls, patched openssl, ...).
58 Building multiple of them while keeping closures separable would be relatively complicated.
59 Separating the builds is easier for now; the missed opportunity to share the 0.3--0.4 MB
60 library isn't such a big deal.
61
62 Moreover upstream still commonly does incompatible changes, so agreeing
63 on a single version might be hard sometimes. That's why it seemed simpler
64 to completely separate the nix expressions, too.
65*/