mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-28 00:24:18 +00:00
e0464e4788
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" ```
79 lines
1.6 KiB
Nix
79 lines
1.6 KiB
Nix
{ lib
|
|
, stdenv
|
|
, fetchFromGitHub
|
|
, Security
|
|
, cmake
|
|
, pkg-config
|
|
, asio
|
|
, nettle
|
|
, gnutls
|
|
, msgpack-cxx
|
|
, readline
|
|
, libargon2
|
|
, jsoncpp
|
|
, restinio
|
|
, http-parser
|
|
, openssl
|
|
, fmt
|
|
, enableProxyServerAndClient ? false
|
|
, enablePushNotifications ? false
|
|
}:
|
|
|
|
stdenv.mkDerivation rec {
|
|
pname = "opendht";
|
|
version = "3.2.0";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "savoirfairelinux";
|
|
repo = "opendht";
|
|
rev = "v${version}";
|
|
hash = "sha256-s172Sj1EvV7Lmnmd+xyKmYF2cDEa8Bot10ovggEsOFg=";
|
|
};
|
|
|
|
nativeBuildInputs = [
|
|
cmake
|
|
pkg-config
|
|
];
|
|
|
|
buildInputs = [
|
|
asio
|
|
fmt
|
|
nettle
|
|
gnutls
|
|
msgpack-cxx
|
|
readline
|
|
libargon2
|
|
] ++ lib.optionals enableProxyServerAndClient [
|
|
jsoncpp
|
|
restinio
|
|
http-parser
|
|
openssl
|
|
] ++ lib.optionals stdenv.hostPlatform.isDarwin [
|
|
Security
|
|
];
|
|
|
|
cmakeFlags = lib.optionals enableProxyServerAndClient [
|
|
"-DOPENDHT_PROXY_SERVER=ON"
|
|
"-DOPENDHT_PROXY_CLIENT=ON"
|
|
] ++ lib.optionals enablePushNotifications [
|
|
"-DOPENDHT_PUSH_NOTIFICATIONS=ON"
|
|
];
|
|
|
|
# https://github.com/savoirfairelinux/opendht/issues/612
|
|
postPatch = ''
|
|
substituteInPlace CMakeLists.txt \
|
|
--replace '\$'{exec_prefix}/'$'{CMAKE_INSTALL_LIBDIR} '$'{CMAKE_INSTALL_FULL_LIBDIR} \
|
|
--replace '\$'{prefix}/'$'{CMAKE_INSTALL_INCLUDEDIR} '$'{CMAKE_INSTALL_FULL_INCLUDEDIR}
|
|
'';
|
|
|
|
outputs = [ "out" "lib" "dev" "man" ];
|
|
|
|
meta = with lib; {
|
|
description = "C++11 Kademlia distributed hash table implementation";
|
|
homepage = "https://github.com/savoirfairelinux/opendht";
|
|
license = licenses.gpl3Plus;
|
|
maintainers = with maintainers; [ taeer olynch thoughtpolice ];
|
|
platforms = platforms.unix;
|
|
};
|
|
}
|