nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 buildPecl,
5 cargo,
6 rustc,
7 fetchFromGitHub,
8 rustPlatform,
9 curl,
10 pcre2,
11 libiconv,
12}:
13
14buildPecl rec {
15 pname = "ddtrace";
16 version = "1.16.0";
17
18 src = fetchFromGitHub {
19 owner = "DataDog";
20 repo = "dd-trace-php";
21 rev = version;
22 fetchSubmodules = true;
23 hash = "sha256-o9g0PT/EbBlB9h2FGyYJsKoNUcJIhGR0hv3owztcvcw=";
24 };
25
26 cargoDeps = rustPlatform.fetchCargoVendor {
27 inherit src;
28 hash = "sha256-vcM+iLpJiIxMqw/Xgq4E3hbY77+H1T1UkdJpUOO6dmo=";
29 };
30
31 env.NIX_CFLAGS_COMPILE = "-O2";
32
33 # Fix double slashes in Makefile paths to prevent impure path errors during
34 # linking. The Makefile has /$(builddir)/components-rs/... but builddir is
35 # already absolute (/build/source), creating //build/source/... paths.
36 postConfigure = ''
37 substituteInPlace Makefile --replace-fail '/$(builddir)/components-rs' '$(builddir)/components-rs'
38 '';
39
40 nativeBuildInputs = [
41 cargo
42 rustc
43 rustPlatform.bindgenHook
44 rustPlatform.cargoSetupHook
45 ];
46
47 buildInputs = [
48 curl
49 pcre2
50 ]
51 ++ lib.optionals stdenv.hostPlatform.isDarwin [
52 libiconv
53 ];
54
55 meta = {
56 changelog = "https://github.com/DataDog/dd-trace-php/blob/${src.rev}/CHANGELOG.md";
57 description = "Datadog Tracing PHP Client";
58 homepage = "https://github.com/DataDog/dd-trace-php";
59 license = with lib.licenses; [
60 asl20
61 bsd3
62 ];
63 teams = [ lib.teams.php ];
64 };
65}