core/pkgs/by-name/s2/s2n-tls/default.nix

62 lines
1.4 KiB
Nix
Raw Normal View History

2024-06-30 08:16:52 +00:00
{
lib,
stdenv,
fetchFromGitHub,
cmake,
openssl,
nix,
2024-05-02 00:46:19 +00:00
}:
stdenv.mkDerivation rec {
pname = "s2n-tls";
version = "1.4.9";
src = fetchFromGitHub {
owner = "aws";
repo = pname;
rev = "v${version}";
hash = "sha256-YH35+kCvPjeBYMMJi7YdAGk/ds3YPm5SSKpoWfbCI3M=";
};
nativeBuildInputs = [ cmake ];
2024-06-30 08:16:52 +00:00
outputs = [
"out"
"dev"
];
2024-05-02 00:46:19 +00:00
buildInputs = [ openssl ]; # s2n-config has find_dependency(LibCrypto).
2024-06-30 08:16:52 +00:00
cmakeFlags =
[
"-DBUILD_SHARED_LIBS=ON"
"-DUNSAFE_TREAT_WARNINGS_AS_ERRORS=OFF" # disable -Werror
]
++ lib.optionals stdenv.hostPlatform.isMips64 [
# See https://github.com/aws/s2n-tls/issues/1592 and https://github.com/aws/s2n-tls/pull/1609
"-DS2N_NO_PQ=ON"
];
2024-05-02 00:46:19 +00:00
propagatedBuildInputs = [ openssl ]; # s2n-config has find_dependency(LibCrypto).
postInstall = ''
# Glob for 'shared' or 'static' subdir
for f in $out/lib/s2n/cmake/*/s2n-targets.cmake; do
substituteInPlace "$f" \
--replace 'INTERFACE_INCLUDE_DIRECTORIES "''${_IMPORT_PREFIX}/include"' 'INTERFACE_INCLUDE_DIRECTORIES ""'
done
'';
passthru.tests = {
inherit nix;
};
meta = with lib; {
description = "C99 implementation of the TLS/SSL protocols";
homepage = "https://github.com/aws/s2n-tls";
license = licenses.asl20;
platforms = platforms.unix;
maintainers = with maintainers; [ orivej ];
};
}