nixpkgs/pkgs/applications/blockchains/haven-cli/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, fetchFromGitHub, cmake, ninja, pkg-config
, boost, miniupnpc, openssl, unbound
, zeromq, pcsclite, readline, libsodium, hidapi
, randomx, rapidjson, easyloggingpp
, CoreData, IOKit, PCSC
, trezorSupport ? true, libusb1, protobuf, python3
, monero-cli
}:
stdenv.mkDerivation rec {
pname = "haven-cli";
version = "4.1.0";
src = fetchFromGitHub {
owner = "haven-protocol-org";
repo = "haven-main";
rev = "v${version}";
hash = "sha256-UPDhvARXatqvxwsuSfxdasVcLbjkXOpK8yY7GoEPxxw=";
fetchSubmodules = true;
};
inherit (monero-cli) patches;
postPatch = ''
# remove vendored libraries
rm -r external/{miniupnp,randomx,rapidjson}
# export patched source for haven-gui
cp -r . $source
'';
nativeBuildInputs = [ cmake ninja pkg-config ];
buildInputs = [
boost miniupnpc openssl unbound
zeromq pcsclite readline
libsodium hidapi randomx rapidjson
protobuf readline easyloggingpp
] ++ lib.optionals stdenv.hostPlatform.isDarwin [ IOKit CoreData PCSC ]
++ lib.optionals trezorSupport [ libusb1 protobuf python3 ];
cmakeFlags = [
"-DBUILD_GUI_DEPS=ON"
"-DReadline_ROOT_DIR=${readline.dev}"
"-DReadline_INCLUDE_DIR=${readline.dev}/include/readline"
"-DRandomX_ROOT_DIR=${randomx}"
] ++ lib.optional stdenv.hostPlatform.isDarwin "-DBoost_USE_MULTITHREADED=OFF"
++ lib.optional (!trezorSupport) "-DUSE_DEVICE_TREZOR=OFF";
outputs = [ "out" "source" ];
meta = with lib; {
description = "Haven Protocol is the world's only network of private stable asset";
homepage = "https://havenprotocol.org/";
license = licenses.bsd3;
platforms = platforms.all;
badPlatforms = [ "x86_64-darwin" ];
maintainers = with maintainers; [ kim0 ];
mainProgram = "haven-wallet-cli";
};
}