diff --git a/pkgs/development/python-modules/chiavdf/default.nix b/pkgs/development/python-modules/chiavdf/default.nix new file mode 100644 index 00000000000..deb7d21adc7 --- /dev/null +++ b/pkgs/development/python-modules/chiavdf/default.nix @@ -0,0 +1,53 @@ +{ lib +, stdenv +, buildPythonPackage +, fetchPypi +, setuptools-scm +, substituteAll +, cmake +, boost +, gmp +, pybind11 +, pytestCheckHook +, pythonOlder +}: + +buildPythonPackage rec { + pname = "chiavdf"; + version = "1.0.1"; + disabled = pythonOlder "3.7"; + + src = fetchPypi { + inherit pname version; + hash = "sha256-z0od/VrH580+9641lKNI7jbVMlJZKCWnoT+GljnFxmU="; + }; + + patches = [ + # prevent CMake from trying to get libraries on the Internet + (substituteAll { + src = ./dont_fetch_dependencies.patch; + pybind11_src = pybind11.src; + }) + ]; + + # x86 instructions are needed for this component + BUILD_VDF_CLIENT = lib.optionalString (!stdenv.isx86_64) "N"; + + nativeBuildInputs = [ cmake setuptools-scm ]; + + buildInputs = [ boost gmp pybind11 ]; + + checkInputs = [ + pytestCheckHook + ]; + + # CMake needs to be run by setuptools rather than by its hook + dontConfigure = true; + + meta = with lib; { + description = "Chia verifiable delay function utilities"; + homepage = "https://www.chia.net/"; + license = licenses.asl20; + maintainers = teams.chia.members; + }; +} diff --git a/pkgs/development/python-modules/chiavdf/dont_fetch_dependencies.patch b/pkgs/development/python-modules/chiavdf/dont_fetch_dependencies.patch new file mode 100644 index 00000000000..9b49db81fcf --- /dev/null +++ b/pkgs/development/python-modules/chiavdf/dont_fetch_dependencies.patch @@ -0,0 +1,14 @@ +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index c975128..a9f6910 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -31,8 +31,7 @@ include(FetchContent) + + FetchContent_Declare( + pybind11-src +- GIT_REPOSITORY https://github.com/pybind/pybind11.git +- GIT_TAG v2.6.2 ++ SOURCE_DIR @pybind11_src@ + ) + FetchContent_MakeAvailable(pybind11-src) + diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index e61249e7257..25bc1d8eeea 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -1347,6 +1347,8 @@ in { chiapos = callPackage ../development/python-modules/chiapos { }; + chiavdf = callPackage ../development/python-modules/chiavdf { }; + chirpstack-api = callPackage ../development/python-modules/chirpstack-api { }; ci-info = callPackage ../development/python-modules/ci-info { };