From 2bceabf2fbdd677b325f75181b9b99ed7bc3df75 Mon Sep 17 00:00:00 2001 From: Christian Ulrich Date: Thu, 29 Oct 2020 01:07:16 +0100 Subject: [PATCH] add quicly --- default.nix | 2 ++ pkgs/quicly/default.nix | 80 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 82 insertions(+) create mode 100644 pkgs/quicly/default.nix diff --git a/default.nix b/default.nix index 303604e..2ce86ce 100644 --- a/default.nix +++ b/default.nix @@ -23,6 +23,8 @@ self: super: picoquic = super.callPackage ./pkgs/picoquic/default.nix { }; + quicly = super.callPackage ./pkgs/quicly/default.nix { }; + shinto-cli = super.callPackage ./pkgs/shinto-cli { }; ui = super.callPackage ./pkgs/nim-packages/ui.nix { }; diff --git a/pkgs/quicly/default.nix b/pkgs/quicly/default.nix new file mode 100644 index 0000000..18e6b4b --- /dev/null +++ b/pkgs/quicly/default.nix @@ -0,0 +1,80 @@ +{ stdenv +, cmake +, openssl +, perl +, fetchFromGitHub +}: + +let + picotls = fetchFromGitHub { + owner = "h2o"; + repo = "picotls"; + rev = "9238121fa7788e8642072b6d4d1a2f2fb71db242"; + sha256 = "0yam62yd606q8v515r74l110gmch4i4bif9hfxn7mgvcdv979l7d"; + }; + + picotest = fetchFromGitHub { + owner = "h2o"; + repo = "picotest"; + rev = "6906d90b39684b8b2c18db5b0c7412128140655d"; + sha256 = "1z26mcg40bkrgbxgh4469y97lixls00p75k9j9dw1w18bg8mg49n"; + }; + + klib = fetchFromGitHub { + owner = "attractivechaos"; + repo = "klib"; + rev = "928581a78413bed4efa956731b35b18a638f20f3"; + sha256 = "0zzmnh6vgivrm9yky181lm1pxjz7hx98p3hs59dws3zdmv8dfvwj"; + }; +in +stdenv.mkDerivation rec { + pname = "quicly"; + version = "20201024"; + + src = fetchFromGitHub { + owner = "h2o"; + repo = "quicly"; + rev = "d80c87059b6aefd8ab74c370378315f5b077b904"; + sha256 = "0l92snfvifmblskxqsrrncjnpy9hhsi7gmvzghbsxk0vx6729h71"; + }; + + outputs = [ "out" "dev" ]; + + nativeBuildInputs = [ + cmake + perl + ]; + + buildInputs = [ + openssl + ]; + + patchPhase = '' + sed -i 's|''${CMAKE_SOURCE_DIR}/deps/picotls|${picotls}|g' CMakeLists.txt + sed -i 's|deps/klib|${klib}|g' CMakeLists.txt + sed -i 's|deps/picotls|${picotls}|g' CMakeLists.txt + sed -i 's|deps/picotest|${picotest}|g' CMakeLists.txt + sed -i 's|\.\./deps/picotls|${picotls}|g' src/cli.c + ''; + + installPhase = '' + runHook preInstall + + mv cli quicly + install -Dt $out/bin quicly + install -Dt $out/lib *.a + install -Dt $dev/include ../include/quicly.h + install -Dt $dev/include/quicly ../include/quicly/*.h + install -Dt $dev/include/quicly ${picotls}/include/picotls.h + + runHook postInstall + ''; + + meta = with stdenv.lib; { + description = "A modular QUIC stack designed primarily for H2O"; + homepage = https://github.com/h2o/quicly; + license = licenses.mit; + maintainers = with maintainers; [ royneary ]; + platforms = platforms.linux; + }; +}