lol
1{
2 lib,
3 stdenv,
4
5 fetchFromGitHub,
6
7 cmake,
8 ninja,
9
10 glog,
11 gflags,
12 folly,
13 fb303,
14 wangle,
15 fbthrift,
16 gtest,
17
18 nix-update-script,
19}:
20
21stdenv.mkDerivation (finalAttrs: {
22 pname = "edencommon";
23 version = "2025.04.21.00";
24
25 outputs = [
26 "out"
27 "dev"
28 ];
29
30 src = fetchFromGitHub {
31 owner = "facebookexperimental";
32 repo = "edencommon";
33 tag = "v${finalAttrs.version}";
34 hash = "sha256-WlLQb4O4rGhXp+bQrJA12CvrwcIS6vzO4W6bX04vKMM=";
35 };
36
37 patches = [
38 ./glog-0.7.patch
39 ]
40 ++ lib.optionals (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isx86_64) [
41 # Test discovery timeout is bizarrely flaky on `x86_64-darwin`
42 ./increase-test-discovery-timeout.patch
43 ];
44
45 nativeBuildInputs = [
46 cmake
47 ninja
48 ];
49
50 buildInputs = [
51 glog
52 gflags
53 folly
54 fb303
55 wangle
56 fbthrift
57 gtest
58 ];
59
60 cmakeFlags = [
61 (lib.cmakeBool "BUILD_SHARED_LIBS" (!stdenv.hostPlatform.isStatic))
62
63 (lib.cmakeBool "CMAKE_INSTALL_RPATH_USE_LINK_PATH" true)
64
65 (lib.cmakeFeature "INCLUDE_INSTALL_DIR" "${placeholder "dev"}/include")
66 (lib.cmakeFeature "LIB_INSTALL_DIR" "${placeholder "out"}/lib")
67 (lib.cmakeFeature "CMAKE_INSTALL_DIR" "${placeholder "dev"}/lib/cmake/edencommon")
68 ];
69
70 doCheck = true;
71
72 checkPhase = ''
73 runHook preCheck
74
75 # Skip flaky test
76 ctest -j $NIX_BUILD_CORES --output-on-failure ${
77 lib.escapeShellArgs [
78 "--exclude-regex"
79 (lib.concatMapStringsSep "|" (test: "^${lib.escapeRegex test}$") [
80 "ProcessInfoCache.addFromMultipleThreads"
81 ])
82 ]
83 }
84
85 runHook postCheck
86 '';
87
88 postPatch = ''
89 # The CMake build requires the FBThrift Python support even though
90 # it’s not used, presumably because of the relevant code having
91 # been moved in from another repository.
92 substituteInPlace CMakeLists.txt \
93 --replace-fail \
94 'find_package(FBThrift CONFIG REQUIRED COMPONENTS cpp2 py)' \
95 'find_package(FBThrift CONFIG REQUIRED COMPONENTS cpp2)'
96 '';
97
98 passthru.updateScript = nix-update-script { };
99
100 meta = {
101 description = "Shared library for Meta's source control filesystem tools (EdenFS and Watchman)";
102 homepage = "https://github.com/facebookexperimental/edencommon";
103 license = lib.licenses.mit;
104 platforms = lib.platforms.unix;
105 maintainers = with lib.maintainers; [
106 kylesferrazza
107 emily
108 techknowlogick
109 ];
110 };
111})