nixpkgs/pkgs/servers/nosql/rethinkdb/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

61 lines
1.8 KiB
Nix

{ lib, stdenv, fetchurl, which, m4
, protobuf, boost, zlib, curl, openssl, icu, jemalloc, libtool
, python3Packages, makeWrapper
}:
stdenv.mkDerivation rec {
pname = "rethinkdb";
version = "2.4.4";
src = fetchurl {
url = "https://download.rethinkdb.com/repository/raw/dist/${pname}-${version}.tgz";
hash = "sha256-UJEjdgK2KDDbLLParKarNGMjI3QeZxDC8N5NhPRCcR8=";
};
postPatch = ''
substituteInPlace external/quickjs_*/Makefile \
--replace "gcc-ar" "${stdenv.cc.targetPrefix}ar" \
--replace "gcc" "${stdenv.cc.targetPrefix}cc"
'';
preConfigure = ''
export ALLOW_WARNINGS=1
patchShebangs .
'';
configureFlags = lib.optionals (!stdenv.hostPlatform.isDarwin) [
"--with-jemalloc"
"--lib-path=${jemalloc}/lib"
];
makeFlags = [ "rethinkdb" ];
buildInputs = [ protobuf boost zlib curl openssl icu ]
++ lib.optional (!stdenv.hostPlatform.isDarwin) jemalloc
++ lib.optional stdenv.hostPlatform.isDarwin libtool;
nativeBuildInputs = [ which m4 python3Packages.python makeWrapper ];
enableParallelBuilding = true;
postInstall = ''
wrapProgram $out/bin/rethinkdb \
--prefix PATH ":" "${python3Packages.rethinkdb}/bin"
'';
meta = {
description = "Open-source distributed database built with love";
mainProgram = "rethinkdb";
longDescription = ''
RethinkDB is built to store JSON documents, and scale to
multiple machines with very little effort. It has a pleasant
query language that supports really useful queries like table
joins and group by, and is easy to setup and learn.
'';
homepage = "https://rethinkdb.com";
license = lib.licenses.asl20;
platforms = lib.platforms.unix;
maintainers = with lib.maintainers; [ thoughtpolice bluescreen303 ];
};
}