nixpkgs/pkgs/development/python-modules/trezor/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

68 lines
1.4 KiB
Nix

{
stdenv,
lib,
buildPythonPackage,
fetchPypi,
click,
construct,
construct-classes,
ecdsa,
libusb1,
mnemonic,
requests,
setuptools,
typing-extensions,
trezor-udev-rules,
pytestCheckHook,
}:
buildPythonPackage rec {
pname = "trezor";
version = "0.13.9";
pyproject = true;
src = fetchPypi {
inherit pname version;
hash = "sha256-lFC9e7nSPl4zo8nljhjwWLRMnZw0ymZLSYGnlaqfse8=";
};
build-system = [ setuptools ];
dependencies = [
click
construct
construct-classes
ecdsa
libusb1
mnemonic
requests
typing-extensions
] ++ lib.optionals stdenv.hostPlatform.isLinux [ trezor-udev-rules ];
nativeCheckInputs = [ pytestCheckHook ];
disabledTestPaths = [
"tests/test_stellar.py" # requires stellar-sdk
"tests/test_firmware.py" # requires network downloads
];
pythonImportsCheck = [ "trezorlib" ];
postCheck = ''
$out/bin/trezorctl --version
'';
meta = with lib; {
description = "Python library for communicating with Trezor Hardware Wallet";
mainProgram = "trezorctl";
homepage = "https://github.com/trezor/trezor-firmware/tree/master/python";
changelog = "https://github.com/trezor/trezor-firmware/blob/python/v${version}/python/CHANGELOG.md";
license = licenses.lgpl3Only;
maintainers = with maintainers; [
np
prusnak
mmahut
];
};
}