nixpkgs/pkgs/applications/misc/electron-cash/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

101 lines
2.5 KiB
Nix

{ lib, stdenv, fetchFromGitHub, python3Packages, wrapQtAppsHook
, secp256k1, qtwayland }:
python3Packages.buildPythonApplication rec {
pname = "electron-cash";
version = "4.3.1";
src = fetchFromGitHub {
owner = "Electron-Cash";
repo = "Electron-Cash";
rev = "refs/tags/${version}";
sha256 = "sha256-xOyj5XerOwgfvI0qj7+7oshDvd18h5IeZvcJTis8nWo=";
};
build-system = with python3Packages; [
cython
];
propagatedBuildInputs = with python3Packages; [
# requirements
pyaes
ecdsa
requests
qrcode
protobuf
jsonrpclib-pelix
pysocks
qdarkstyle
python-dateutil
stem
certifi
pathvalidate
dnspython
bitcoinrpc
# requirements-binaries
pyqt5
psutil
pycryptodomex
cryptography
# requirements-hw
trezor
keepkey
btchip-python
hidapi
pyopenssl
pyscard
pysatochip
];
nativeBuildInputs = [ wrapQtAppsHook ];
buildInputs = [ ] ++ lib.optional stdenv.hostPlatform.isLinux qtwayland;
postPatch = ''
substituteInPlace contrib/requirements/requirements.txt \
--replace "qdarkstyle==2.6.8" "qdarkstyle<3"
substituteInPlace setup.py \
--replace "(share_dir" "(\"share\""
'';
postInstall = lib.optionalString stdenv.hostPlatform.isLinux ''
substituteInPlace $out/share/applications/electron-cash.desktop \
--replace "Exec=electron-cash" "Exec=$out/bin/electron-cash"
'';
# If secp256k1 wasn't added to the library path, the following warning is given:
#
# Electron Cash was unable to find the secp256k1 library on this system.
# Elliptic curve cryptography operations will be performed in slow
# Python-only mode.
preFixup = ''
makeWrapperArgs+=("''${qtWrapperArgs[@]}")
makeWrapperArgs+=(
"--prefix" "LD_LIBRARY_PATH" ":" "${secp256k1}/lib"
)
'';
doInstallCheck = true;
installCheckPhase = ''
$out/bin/electron-cash help >/dev/null
'';
meta = with lib; {
description = "Bitcoin Cash SPV Wallet";
mainProgram = "electron-cash";
longDescription = ''
An easy-to-use Bitcoin Cash client featuring wallets generated from
mnemonic seeds (in addition to other, more advanced, wallet options)
and the ability to perform transactions without downloading a copy
of the blockchain.
'';
homepage = "https://www.electroncash.org/";
platforms = platforms.unix;
maintainers = with maintainers; [ lassulus nyanloutre oxalica ];
license = licenses.mit;
};
}