1{ buildPythonPackage
2, lib
3, fetchFromGitHub
4, pytestCheckHook
5, rustPlatform
6}:
7
8buildPythonPackage rec {
9 pname = "chia-rs";
10 version = "0.2.0";
11
12 src = fetchFromGitHub {
13 owner = "chia-network";
14 repo = "chia_rs";
15 rev = version;
16 hash = "sha256-kjURkzynrrb5iD5s77Q3nETt71SCGGazm/2lt9HS5JU=";
17 };
18
19 patches = [
20 # undo a hack from upstream that confuses our build hook
21 ./fix-build.patch
22 ];
23
24 cargoDeps = rustPlatform.importCargoLock {
25 lockFile = ./Cargo.lock;
26 };
27
28 postPatch = ''
29 cp ${./Cargo.lock} Cargo.lock
30 '';
31
32 nativeBuildInputs = with rustPlatform; [
33 cargoSetupHook
34 maturinBuildHook
35 ];
36
37 preBuild = ''
38 # avoid ENOENT in maturinBuildHook
39 touch wheel/Cargo.lock
40 '';
41
42 nativeCheckInputs = [
43 pytestCheckHook
44 ];
45
46 buildAndTestSubdir = "wheel";
47
48 meta = with lib; {
49 description = "Rust crate & wheel with consensus code";
50 homepage = "https://github.com/Chia-Network/chia_rs/";
51 license = licenses.asl20;
52 maintainers = teams.chia.members;
53 };
54}