blob: 015a3b9a72c98281acbb621d8123a8999b7a2c6b (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
{ lib
, stdenv
, fetchFromGitHub
, cargo
, rustPlatform
, cargo-c
, validatePkgConfig
, rust
, libiconv
, darwin
, curl
, apacheHttpd
, testers
}:
stdenv.mkDerivation (finalAttrs: {
pname = "rustls-ffi";
version = "0.13.0";
src = fetchFromGitHub {
owner = "rustls";
repo = "rustls-ffi";
rev = "v${finalAttrs.version}";
hash = "sha256-Bc9bVZ2pDsG118l/SlElZpgh9F1JEgPF8LzBX7d4mhE=";
};
cargoDeps = rustPlatform.fetchCargoTarball {
src = finalAttrs.src;
name = "${finalAttrs.pname}-${finalAttrs.version}";
hash = "sha256-gDQ9AFrJuV7SrzKCAHQBkKj6clXuPLO0DHhnvcBqRLs=";
};
propagatedBuildInputs = lib.optionals stdenv.isDarwin [ libiconv darwin.apple_sdk.frameworks.Security ];
nativeBuildInputs = [ cargo rustPlatform.cargoSetupHook cargo-c validatePkgConfig ];
buildPhase = ''
runHook preBuild
${rust.envVars.setEnv} cargo cbuild -j $NIX_BUILD_CORES --release --frozen --prefix=${placeholder "out"} --target ${stdenv.hostPlatform.rust.rustcTarget}
runHook postBuild
'';
installPhase = ''
runHook preInstall
${rust.envVars.setEnv} cargo cinstall -j $NIX_BUILD_CORES --release --frozen --prefix=${placeholder "out"} --target ${stdenv.hostPlatform.rust.rustcTarget}
runHook postInstall
'';
checkPhase = ''
runHook preCheck
${rust.envVars.setEnv} cargo ctest -j $NIX_BUILD_CORES --release --frozen --prefix=${placeholder "out"} --target ${stdenv.hostPlatform.rust.rustcTarget}
runHook postCheck
'';
passthru.tests = {
curl = curl.override { opensslSupport = false; rustlsSupport = true; rustls-ffi = finalAttrs.finalPackage; };
apacheHttpd = apacheHttpd.override { modTlsSupport = true; rustls-ffi = finalAttrs.finalPackage; };
pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage;
};
meta = with lib; {
description = "C-to-rustls bindings";
homepage = "https://github.com/rustls/rustls-ffi/";
pkgConfigModules = [ "rustls" ];
license = with lib.licenses; [ mit asl20 isc ];
maintainers = [ maintainers.lesuisse ];
};
})
|