nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ stdenv
2, lib
3, fetchFromGitHub
4, buildPythonPackage
5, rustPlatform
6, pythonOlder
7, openssl
8, perl
9, pkgs
10}:
11
12let
13 # clvm-rs does not work with maturin 0.12
14 # https://github.com/Chia-Network/clvm_rs/commit/32fba40178a5440a1306623f47d8b0684ae2339a#diff-50c86b7ed8ac2cf95bd48334961bf0530cdc77b5a56f852c5c61b89d735fd711
15 maturin_0_11 = with pkgs; rustPlatform.buildRustPackage rec {
16 pname = "maturin";
17 version = "0.11.5";
18 src = fetchFromGitHub {
19 owner = "PyO3";
20 repo = "maturin";
21 rev = "v${version}";
22 hash = "sha256-hwc6WObcJa6EXf+9PRByUtiupMMYuXThA8i/K4rl0MA=";
23 };
24 cargoHash = "sha256-qGCEfKpQwAC57LKonFnUEgLW4Cc7HFJgSyUOzHkKN9c=";
25
26
27 nativeBuildInputs = [ pkg-config ];
28
29 buildInputs = lib.optionals stdenv.isLinux [ dbus ]
30 ++ lib.optionals stdenv.isDarwin [ darwin.apple_sdk.frameworks.Security libiconv ];
31
32 # Requires network access, fails in sandbox.
33 doCheck = false;
34 };
35in
36
37buildPythonPackage rec {
38 pname = "clvm_rs";
39 version = "0.1.19";
40 disabled = pythonOlder "3.7";
41
42 src = fetchFromGitHub {
43 owner = "Chia-Network";
44 repo = "clvm_rs";
45 rev = version;
46 sha256 = "sha256-mCKY/PqNOUTaRsFDxQBvbTD6wC4qzP0uv5FldYkwl6c=";
47 };
48
49 cargoDeps = rustPlatform.fetchCargoTarball {
50 inherit src;
51 name = "${pname}-${version}";
52 sha256 = "sha256-TmrR8EeySsGWXohMdo3dCX4oT3l9uLVv5TUeRxCBQeE=";
53 };
54
55 format = "pyproject";
56
57 buildAndTestSubdir = "wheel";
58
59 nativeBuildInputs = [
60 perl # used by openssl-sys to configure
61 maturin_0_11
62 ] ++ (with rustPlatform; [
63 cargoSetupHook
64 maturinBuildHook
65 ]);
66
67 buildInputs = [ openssl ];
68
69 pythonImportsCheck = [ "clvm_rs" ];
70
71 meta = with lib; {
72 broken = stdenv.isDarwin;
73 homepage = "https://chialisp.com/";
74 description = "Rust implementation of clvm";
75 license = licenses.asl20;
76 maintainers = teams.chia.members;
77 };
78}