1{ stdenv
2, lib
3, substituteAll
4, buildPythonPackage
5, fetchPypi
6, catch2
7, cmake
8, cxxopts
9, ghc_filesystem
10, pybind11
11, pytestCheckHook
12, pythonOlder
13, psutil
14, setuptools-scm
15}:
16
17buildPythonPackage rec {
18 pname = "chiapos";
19 version = "1.0.11";
20 disabled = pythonOlder "3.7";
21
22 src = fetchPypi {
23 inherit pname version;
24 hash = "sha256-TMRf9549z3IQzGt5c53Rk1Vq3tdrpZ3Pqc8jhj4AKzo=";
25 };
26
27 patches = [
28 # prevent CMake from trying to get libraries on the Internet
29 (substituteAll {
30 src = ./dont_fetch_dependencies.patch;
31 inherit cxxopts ghc_filesystem;
32 catch2_src = catch2.src;
33 pybind11_src = pybind11.src;
34 })
35 ];
36
37 nativeBuildInputs = [ cmake setuptools-scm ];
38
39 buildInputs = [ pybind11 ];
40
41 nativeCheckInputs = [
42 psutil
43 pytestCheckHook
44 ];
45
46 # A fix for cxxopts >=3.1
47 postPatch = ''
48 substituteInPlace src/cli.cpp \
49 --replace "cxxopts::OptionException" "cxxopts::exceptions::exception"
50 '';
51
52 # CMake needs to be run by setuptools rather than by its hook
53 dontConfigure = true;
54
55 meta = with lib; {
56 broken = stdenv.isDarwin;
57 description = "Chia proof of space library";
58 homepage = "https://www.chia.net/";
59 license = licenses.asl20;
60 maintainers = teams.chia.members;
61 };
62}