about summary refs log tree commit diff
path: root/pkgs/development/libraries/rustls-ffi/default.nix
blob: 92dffbc2682fc39beb5833f98b7c1ceb7cc43cf7 (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
{
  lib,
  stdenv,
  fetchFromGitHub,
  rustPlatform,
  Security,
  apacheHttpd,
}:

rustPlatform.buildRustPackage rec {
  pname = "rustls-ffi";
  version = "0.10.0";

  src = fetchFromGitHub {
    owner = "rustls";
    repo = pname;
    rev = "v${version}";
    hash = "sha256-IDIWN5g1aaE6SDdXSm4WYK6n+BpuypPYQITuDj1WJEc=";
  };

  propagatedBuildInputs = lib.optionals stdenv.hostPlatform.isDarwin [ Security ];

  cargoLock.lockFile = ./Cargo.lock;
  postPatch = ''
    cp ${./Cargo.lock} Cargo.lock
  '';

  installPhase = ''
    runHook preInstall

    make install DESTDIR=${placeholder "out"}

    runHook postInstall
  '';

  passthru.tests = {
    apacheHttpd = apacheHttpd.override { modTlsSupport = true; };
    # Currently broken notably because of https://github.com/curl/curl/issues/13248
    # curl = curl.override { opensslSupport = false; rustlsSupport = true; };
  };

  meta = with lib; {
    description = "C-to-rustls bindings";
    homepage = "https://github.com/rustls/rustls-ffi/";
    license = with lib.licenses; [
      mit
      asl20
      isc
    ];
    maintainers = [ maintainers.lesuisse ];
  };
}