1{
2 lib,
3 stdenv,
4
5 fetchFromGitHub,
6
7 cmake,
8 ninja,
9 sanitiseHeaderPathsHook,
10
11 folly,
12 fizz,
13 openssl,
14 glog,
15 gflags,
16 libevent,
17 double-conversion,
18
19 gtest,
20
21 nix-update-script,
22}:
23
24stdenv.mkDerivation (finalAttrs: {
25 pname = "wangle";
26 version = "2025.04.21.00";
27
28 outputs = [
29 "out"
30 "dev"
31 ];
32
33 src = fetchFromGitHub {
34 owner = "facebook";
35 repo = "wangle";
36 tag = "v${finalAttrs.version}";
37 hash = "sha256-t3b+R2tb4VTsjDL9Jzjcaehs5k+BLNLilm3+nXxyjj0=";
38 };
39
40 patches = [
41 ./glog-0.7.patch
42 ];
43
44 nativeBuildInputs = [
45 cmake
46 ninja
47 sanitiseHeaderPathsHook
48 ];
49
50 buildInputs = [
51 folly
52 fizz
53 openssl
54 glog
55 gflags
56 libevent
57 double-conversion
58 ];
59
60 checkInputs = [
61 gtest
62 ];
63
64 cmakeDir = "../wangle";
65
66 cmakeFlags = [
67 (lib.cmakeBool "BUILD_SHARED_LIBS" (!stdenv.hostPlatform.isStatic))
68
69 (lib.cmakeBool "BUILD_TESTS" finalAttrs.finalPackage.doCheck)
70
71 (lib.cmakeFeature "INCLUDE_INSTALL_DIR" "${placeholder "dev"}/include")
72 (lib.cmakeFeature "LIB_INSTALL_DIR" "${placeholder "out"}/lib")
73 (lib.cmakeFeature "CMAKE_INSTALL_DIR" "${placeholder "dev"}/lib/cmake/wangle")
74 ];
75
76 env.GTEST_FILTER =
77 "-"
78 + lib.concatStringsSep ":" (
79 [
80 # these depend on example pem files from the folly source tree (?)
81 "SSLContextManagerTest.TestSingleClientCAFileSet"
82 "SSLContextManagerTest.TestMultipleClientCAsSet"
83 ]
84 ++ lib.optionals stdenv.hostPlatform.isDarwin [
85 # flaky
86 "BroadcastPoolTest.ThreadLocalPool"
87 "Bootstrap.UDPClientServerTest"
88 ]
89 );
90
91 __darwinAllowLocalNetworking = true;
92
93 doCheck = true;
94
95 checkPhase = ''
96 runHook preCheck
97
98 ctest -j $NIX_BUILD_CORES --output-on-failure ${
99 # Deterministic glibc abort 🫠
100 # SSLContextManagerTest uses 15+ GB of RAM
101 lib.optionalString stdenv.hostPlatform.isLinux (
102 lib.escapeShellArgs [
103 "--exclude-regex"
104 "^(BootstrapTest|BroadcastPoolTest|SSLContextManagerTest)$"
105 ]
106 )
107 }
108
109 runHook postCheck
110 '';
111
112 passthru.updateScript = nix-update-script { };
113
114 meta = {
115 description = "Open-source C++ networking library";
116 longDescription = ''
117 Wangle is a framework providing a set of common client/server
118 abstractions for building services in a consistent, modular, and
119 composable way.
120 '';
121 homepage = "https://github.com/facebook/wangle";
122 license = lib.licenses.asl20;
123 platforms = lib.platforms.unix;
124 maintainers = with lib.maintainers; [
125 pierreis
126 kylesferrazza
127 emily
128 techknowlogick
129 ];
130 };
131})