7 # Optional dependencies
8 , enableApp ? with stdenv.hostPlatform; !isWindows && !isStatic
9 , c-aresMinimal, libev, openssl, zlib
10 , enableAsioLib ? false, boost
11 , enableGetAssets ? false, libxml2
12 , enableHpack ? false, jansson
13 , enableJemalloc ? false, jemalloc
14 , enablePython ? false, python3Packages, ncurses
16 # Unit tests ; we have to set TZDIR, which is a GNUism.
17 , enableTests ? stdenv.hostPlatform.isGnu, cunit, tzdata
19 # downstream dependencies, for testing
24 # Note: this package is used for bootstrapping fetchurl, and thus cannot use fetchpatch!
25 # All mutable patches (generated by GitHub or cgit) that are needed here
26 # should be included directly in Nixpkgs as files.
28 assert enableGetAssets -> enableApp;
29 assert enableHpack -> enableApp;
30 assert enableJemalloc -> enableApp;
32 stdenv.mkDerivation rec {
37 url = "https://github.com/${pname}/${pname}/releases/download/v${version}/${pname}-${version}.tar.bz2";
38 sha256 = "sha256-LNTbfXX3FJQVMknL6UoJLaTG7NdCQPirGM9kTZ1l9u4=";
41 outputs = [ "bin" "out" "dev" "lib" ]
42 ++ lib.optionals (enablePython) [ "python" ];
44 nativeBuildInputs = [ pkg-config ]
45 ++ lib.optionals (enableApp) [ installShellFiles ]
46 ++ lib.optionals (enablePython) [ python3Packages.cython ];
48 buildInputs = lib.optionals enableApp [ c-aresMinimal libev openssl zlib ]
49 ++ lib.optionals (enableAsioLib) [ boost ]
50 ++ lib.optionals (enableGetAssets) [ libxml2 ]
51 ++ lib.optionals (enableHpack) [ jansson ]
52 ++ lib.optionals (enableJemalloc) [ jemalloc ]
53 ++ lib.optionals (enablePython) [ python3Packages.python ncurses python3Packages.setuptools ];
55 enableParallelBuilding = true;
59 (lib.enableFeature enableApp "app")
60 ] ++ lib.optionals (enableAsioLib) [ "--enable-asio-lib" "--with-boost-libdir=${boost}/lib" ]
61 ++ lib.optionals (enablePython) [ "--with-cython=${python3Packages.cython}/bin/cython" ];
63 # Unit tests require CUnit and setting TZDIR environment variable
64 doCheck = enableTests;
65 checkInputs = lib.optionals (enableTests) [ cunit tzdata ];
66 preCheck = lib.optionalString (enableTests) ''
67 export TZDIR=${tzdata}/share/zoneinfo
70 preInstall = lib.optionalString (enablePython) ''
71 mkdir -p $out/${python3Packages.python.sitePackages}
72 # convince installer it's ok to install here
73 export PYTHONPATH="$PYTHONPATH:$out/${python3Packages.python.sitePackages}"
75 postInstall = lib.optionalString (enablePython) ''
76 mkdir -p $python/${python3Packages.python.sitePackages}
77 mv $out/${python3Packages.python.sitePackages}/* $python/${python3Packages.python.sitePackages}
79 '' + lib.optionalString (enableApp) ''
80 installShellCompletion --bash doc/bash_completion/{h2load,nghttp,nghttpd,nghttpx}
88 description = "HTTP/2 C library and tools";
90 nghttp2 is an implementation of the HyperText Transfer Protocol version 2 in C.
91 The framing layer of HTTP/2 is implemented as a reusable C library. On top of that,
92 we have implemented an HTTP/2 client, server and proxy. We have also developed
93 load test and benchmarking tools for HTTP/2.
94 An HPACK encoder and decoder are available as a public API.
95 We have Python bindings of this library, but we do not have full code coverage yet.
96 An experimental high level C++ library is also available.
99 homepage = "https://nghttp2.org/";
100 changelog = "https://github.com/nghttp2/nghttp2/releases/tag/v${version}";
101 # News articles with changes summary can be found here: https://nghttp2.org/blog/archives/
102 license = licenses.mit;
103 maintainers = with maintainers; [ c0bw3b ];
104 platforms = platforms.all;