about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/ngtcp2
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/ngtcp2')
-rw-r--r--nixpkgs/pkgs/development/libraries/ngtcp2/default.nix51
-rw-r--r--nixpkgs/pkgs/development/libraries/ngtcp2/gnutls.nix53
2 files changed, 104 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/libraries/ngtcp2/default.nix b/nixpkgs/pkgs/development/libraries/ngtcp2/default.nix
new file mode 100644
index 000000000000..9bfd3324242a
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/ngtcp2/default.nix
@@ -0,0 +1,51 @@
+{ lib, stdenv, fetchFromGitHub
+, cmake
+, cunit, ncurses
+, libev, nghttp3, quictls
+, withJemalloc ? false, jemalloc
+, curlHTTP3
+}:
+
+stdenv.mkDerivation rec {
+  pname = "ngtcp2";
+  version = "0.17.0";
+
+  src = fetchFromGitHub {
+    owner = "ngtcp2";
+    repo = pname;
+    rev = "v${version}";
+    hash = "sha256-vY3RooC8ttezru6vAqbG1MU5uZhD8fLnlEYVYS3pFRk=";
+  };
+
+  outputs = [ "out" "dev" "doc" ];
+
+  nativeBuildInputs = [ cmake ];
+  nativeCheckInputs = [ cunit ncurses ];
+  buildInputs = [ libev nghttp3 quictls ] ++ lib.optional withJemalloc jemalloc;
+
+  cmakeFlags = [
+    "-DENABLE_STATIC_LIB=OFF"
+  ];
+
+  preConfigure = ''
+    # https://github.com/ngtcp2/ngtcp2/issues/858
+    # Fix ngtcp2_crypto_openssl remnants.
+    substituteInPlace crypto/includes/CMakeLists.txt \
+      --replace 'ngtcp2/ngtcp2_crypto_openssl.h' 'ngtcp2/ngtcp2_crypto_quictls.h'
+  '';
+
+  doCheck = true;
+  enableParallelBuilding = true;
+
+  passthru.tests = {
+    inherit curlHTTP3;
+  };
+
+  meta = with lib; {
+    homepage = "https://github.com/ngtcp2/ngtcp2";
+    description = "ngtcp2 project is an effort to implement QUIC protocol which is now being discussed in IETF QUICWG for its standardization.";
+    license = licenses.mit;
+    platforms = platforms.unix;
+    maintainers = with maintainers; [ izorkin ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/ngtcp2/gnutls.nix b/nixpkgs/pkgs/development/libraries/ngtcp2/gnutls.nix
new file mode 100644
index 000000000000..05341188be6c
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/ngtcp2/gnutls.nix
@@ -0,0 +1,53 @@
+{ lib, stdenv, fetchFromGitHub
+, autoreconfHook, pkg-config
+, gnutls
+, cunit, ncurses, knot-dns
+}:
+
+stdenv.mkDerivation rec {
+  pname = "ngtcp2";
+  version = "0.18.0";
+
+  src = fetchFromGitHub {
+    owner = "ngtcp2";
+    repo = "ngtcp2";
+    rev = "v${version}";
+    hash = "sha256-FkiqQZ6xmwU2vkJxmr7k+Va5jIByWayAfUea+2DCFhk=";
+  };
+
+  outputs = [ "out" "dev" ];
+
+  nativeBuildInputs = [ autoreconfHook pkg-config ];
+  buildInputs = [ gnutls ];
+
+  configureFlags = [ "--with-gnutls=yes" ];
+  enableParallelBuilding = true;
+
+  doCheck = true;
+  nativeCheckInputs = [ cunit ]
+    ++ lib.optional stdenv.isDarwin ncurses;
+
+  passthru.tests = knot-dns.passthru.tests; # the only consumer so far
+
+  meta = with lib; {
+    homepage = "https://github.com/ngtcp2/ngtcp2";
+    description = "an effort to implement RFC9000 QUIC protocol.";
+    license = licenses.mit;
+    platforms = platforms.unix;
+    maintainers = with maintainers; [ vcunat/* for knot-dns */ ];
+  };
+}
+
+/*
+  Why split from ./default.nix?
+
+  ngtcp2 libs contain helpers to plug into various crypto libs (gnutls, patched openssl, ...).
+  Building multiple of them while keeping closures separable would be relatively complicated.
+  Separating the builds is easier for now; the missed opportunity to share the 0.3--0.4 MB
+  library isn't such a big deal.
+
+  Moreover upstream still commonly does incompatible changes, so agreeing
+  on a single version might be hard sometimes.  That's why it seemed simpler
+  to completely separate the nix expressions, too.
+*/
+