Merge pull request #268619 from tweag/lib-descriptions
[NixPkgs.git] / pkgs / development / libraries / s2n-tls / default.nix
blob73092a803d66c27c61f56d918afea9064e441819
1 { lib
2 , stdenv
3 , fetchFromGitHub
4 , cmake
5 , openssl
6 , nix
7 }:
9 stdenv.mkDerivation rec {
10   pname = "s2n-tls";
11   version = "1.3.56";
13   src = fetchFromGitHub {
14     owner = "aws";
15     repo = pname;
16     rev = "v${version}";
17     hash = "sha256-VS/85qu0Dc3HSeD0DYm2f4ur+ZRPhb1Srf7BeK7Pdfk=";
18   };
20   nativeBuildInputs = [ cmake ];
22   outputs = [ "out" "dev" ];
24   buildInputs = [ openssl ]; # s2n-config has find_dependency(LibCrypto).
26   cmakeFlags = [
27     "-DBUILD_SHARED_LIBS=ON"
28     "-DUNSAFE_TREAT_WARNINGS_AS_ERRORS=OFF" # disable -Werror
29   ] ++ lib.optionals stdenv.hostPlatform.isMips64 [
30     # See https://github.com/aws/s2n-tls/issues/1592 and https://github.com/aws/s2n-tls/pull/1609
31     "-DS2N_NO_PQ=ON"
32   ];
34   propagatedBuildInputs = [ openssl ]; # s2n-config has find_dependency(LibCrypto).
36   postInstall = ''
37     # Glob for 'shared' or 'static' subdir
38     for f in $out/lib/s2n/cmake/*/s2n-targets.cmake; do
39       substituteInPlace "$f" \
40         --replace 'INTERFACE_INCLUDE_DIRECTORIES "''${_IMPORT_PREFIX}/include"' 'INTERFACE_INCLUDE_DIRECTORIES ""'
41     done
42   '';
44   passthru.tests = {
45     inherit nix;
46   };
48   meta = with lib; {
49     description = "C99 implementation of the TLS/SSL protocols";
50     homepage = "https://github.com/aws/s2n-tls";
51     license = licenses.asl20;
52     platforms = platforms.unix;
53     maintainers = with maintainers; [ orivej ];
54   };