2022-12-02 08:20:57 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
stdenv,
|
|
|
|
fetchzip,
|
|
|
|
cmake,
|
|
|
|
pkg-config,
|
|
|
|
perl,
|
|
|
|
openssl,
|
|
|
|
zlib,
|
|
|
|
cyrus_sasl,
|
|
|
|
libbson,
|
|
|
|
snappy,
|
2023-02-22 10:55:15 +00:00
|
|
|
darwin,
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
2023-02-22 10:55:15 +00:00
|
|
|
let
|
|
|
|
inherit (darwin.apple_sdk.frameworks) Security;
|
|
|
|
in
|
2020-04-24 23:36:52 +00:00
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "mongoc";
|
2023-05-24 13:37:59 +00:00
|
|
|
version = "1.23.4";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchzip {
|
|
|
|
url = "https://github.com/mongodb/mongo-c-driver/releases/download/${version}/mongo-c-driver-${version}.tar.gz";
|
2023-05-24 13:37:59 +00:00
|
|
|
sha256 = "sha256-mJBaRaX0hphvMdTII79DVn1g2uBmpRlObMiJ673Ijpw=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2022-12-02 08:20:57 +00:00
|
|
|
# https://github.com/NixOS/nixpkgs/issues/25585
|
|
|
|
preFixup = ''rm -rf "$(pwd)" '';
|
2023-02-22 10:55:15 +00:00
|
|
|
# https://github.com/mongodb/mongo-c-driver/pull/1157
|
|
|
|
# related:
|
|
|
|
# https://github.com/NixOS/nixpkgs/issues/144170
|
|
|
|
# mongoc's cmake incorrectly injects a prefix to library paths, breaking Nix. This removes the prefix from paths.
|
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace src/libmongoc/CMakeLists.txt \
|
|
|
|
--replace "\\\''${prefix}/" ""
|
|
|
|
substituteInPlace src/libbson/CMakeLists.txt \
|
|
|
|
--replace "\\\''${prefix}/" ""
|
|
|
|
'';
|
2022-12-02 08:20:57 +00:00
|
|
|
|
|
|
|
nativeBuildInputs = [cmake pkg-config perl];
|
2023-02-22 10:55:15 +00:00
|
|
|
buildInputs = [openssl zlib cyrus_sasl] ++ lib.optionals stdenv.isDarwin [Security];
|
2022-12-02 08:20:57 +00:00
|
|
|
propagatedBuildInputs = [libbson snappy];
|
|
|
|
|
|
|
|
# -DMONGOC_TEST_USE_CRYPT_SHARED=OFF
|
|
|
|
# The `mongodl.py` script is causing issues, and you also need to disabled sandboxing for it. However, it is used only to run some tests.
|
|
|
|
# https://www.mongodb.com/community/forums/t/problem-downloading-crypt-shared-when-installing-the-mongodb-c-driver/189370
|
|
|
|
cmakeFlags = ["-DCMAKE_BUILD_TYPE=Release" "-DENABLE_AUTOMATIC_INIT_AND_CLEANUP=OFF" "-DMONGOC_TEST_USE_CRYPT_SHARED=OFF"];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
meta = with lib; {
|
2023-02-22 10:55:15 +00:00
|
|
|
broken = stdenv.isDarwin && stdenv.isx86_64;
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "The official C client library for MongoDB";
|
2022-05-18 14:49:53 +00:00
|
|
|
homepage = "http://mongoc.org";
|
2020-04-24 23:36:52 +00:00
|
|
|
license = licenses.asl20;
|
2022-05-18 14:49:53 +00:00
|
|
|
mainProgram = "mongoc-stat";
|
2022-12-02 08:20:57 +00:00
|
|
|
maintainers = with maintainers; [archer-65];
|
2020-04-24 23:36:52 +00:00
|
|
|
platforms = platforms.all;
|
|
|
|
};
|
|
|
|
}
|