nixpkgs-overlay/pkgs/quicly/default.nix

74 lines
1.7 KiB
Nix

{ stdenv
, cmake
, openssl
, perl
, picotls
, fetchFromGitHub
}:
let
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 = "20201106";
src = fetchFromGitHub {
owner = "h2o";
repo = "quicly";
rev = "f2f0e0a32fcf4e72404864007b08f01e84d6fef5";
sha256 = "1rhfhvkn6ssfmvgyay239bfcpqskzlj9xnl2ca0kmadbxng4xkv5";
};
outputs = [ "out" "dev" ];
nativeBuildInputs = [
cmake
perl
];
buildInputs = [
openssl
];
patchPhase = ''
sed -i 's|''${CMAKE_SOURCE_DIR}/deps/picotls|${picotls.src}|g' CMakeLists.txt
sed -i 's|deps/klib|${klib}|g' CMakeLists.txt
sed -i 's|deps/picotls|${picotls.src}|g' CMakeLists.txt
sed -i 's|deps/picotest|${picotest}|g' CMakeLists.txt
sed -i 's|../deps/picotls|${picotls.src}|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
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;
};
}