nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ lib
2, stdenv
3, fetchFromGitHub
4, cmake
5, openssl
6, nix
7}:
8
9stdenv.mkDerivation rec {
10 pname = "s2n-tls";
11 version = "1.3.44";
12
13 src = fetchFromGitHub {
14 owner = "aws";
15 repo = pname;
16 rev = "v${version}";
17 sha256 = "sha256-8YF9PhxTrXQBTUJvTrJZFDVijQecTeZ1ayGuvQRqGEE=";
18 };
19
20 nativeBuildInputs = [ cmake ];
21
22 outputs = [ "out" "dev" ];
23
24 buildInputs = [ openssl ]; # s2n-config has find_dependency(LibCrypto).
25
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 ];
33
34 propagatedBuildInputs = [ openssl ]; # s2n-config has find_dependency(LibCrypto).
35
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 '';
43
44 passthru.tests = {
45 inherit nix;
46 };
47
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 };
55}