nixpkgs/pkgs/development/libraries/mongoc/default.nix
Artturin e0464e4788 treewide: replace stdenv.is with stdenv.hostPlatform.is
In preparation for the deprecation of `stdenv.isX`.

These shorthands are not conducive to cross-compilation because they
hide the platforms.

Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way

One example of why this is bad and especially affects compiler packages
https://www.github.com/NixOS/nixpkgs/pull/343059

There are too many files to go through manually but a treewide should
get users thinking when they see a `hostPlatform.isX` in a place where it
doesn't make sense.

```
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is"
fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is"
```
2024-09-25 00:04:37 +03:00

63 lines
1.1 KiB
Nix

{ lib
, stdenv
, fetchFromGitHub
, cmake
, pkg-config
, openssl
, zlib
, zstd
, icu
, cyrus_sasl
, snappy
, darwin
}:
stdenv.mkDerivation rec {
pname = "mongoc";
version = "1.28.0";
src = fetchFromGitHub {
owner = "mongodb";
repo = "mongo-c-driver";
rev = "refs/tags/${version}";
hash = "sha256-cfet+A2i33iHbVRouPS4Ul8TmHolrcIMTRba6Olqfeg=";
};
nativeBuildInputs = [
cmake
pkg-config
];
buildInputs = [
openssl
zlib
zstd
icu
cyrus_sasl
snappy
] ++ lib.optionals stdenv.hostPlatform.isDarwin [
darwin.apple_sdk_11_0.frameworks.Security
];
cmakeFlags = [
"-DBUILD_VERSION=${version}"
"-DENABLE_UNINSTALL=OFF"
"-DENABLE_AUTOMATIC_INIT_AND_CLEANUP=OFF"
"-DCMAKE_INSTALL_LIBDIR=lib"
];
# remove forbidden reference to $TMPDIR
preFixup = ''
rm -rf src/{libmongoc,libbson}
'';
meta = with lib; {
description = "Official C client library for MongoDB";
homepage = "http://mongoc.org";
license = licenses.asl20;
mainProgram = "mongoc-stat";
maintainers = with maintainers; [ archer-65 ];
platforms = platforms.all;
};
}