summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/chiapos
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/python-modules/chiapos')
-rw-r--r--pkgs/development/python-modules/chiapos/default.nix48
-rw-r--r--pkgs/development/python-modules/chiapos/dont_fetch_dependencies.patch31
2 files changed, 79 insertions, 0 deletions
diff --git a/pkgs/development/python-modules/chiapos/default.nix b/pkgs/development/python-modules/chiapos/default.nix
new file mode 100644
index 000000000000..1faf5a94f8cc
--- /dev/null
+++ b/pkgs/development/python-modules/chiapos/default.nix
@@ -0,0 +1,48 @@
+{ lib
+, substituteAll
+, buildPythonPackage
+, fetchPypi
+, cmake
+, cxxopts
+, ghc_filesystem
+, pybind11
+, pythonOlder
+, psutil
+, setuptools-scm
+}:
+
+buildPythonPackage rec {
+ pname = "chiapos";
+ version = "1.0.1";
+ disabled = pythonOlder "3.7";
+
+ src = fetchPypi {
+ inherit pname version;
+ hash = "sha256-kJx57EtwPBrGMpjnSzeYYhWqc/g1N1Bg8slW5oZKjg8=";
+ };
+
+ patches = [
+ # prevent CMake from trying to get libraries on the Internet
+ (substituteAll {
+ src = ./dont_fetch_dependencies.patch;
+ inherit cxxopts ghc_filesystem;
+ pybind11_src = pybind11.src;
+ })
+ ];
+
+ nativeBuildInputs = [ cmake setuptools-scm ];
+
+ buildInputs = [ pybind11 ];
+
+ checkInputs = [ psutil ];
+
+ # CMake needs to be run by setuptools rather than by its hook
+ dontConfigure = true;
+
+ meta = with lib; {
+ description = "Chia proof of space library";
+ homepage = "https://www.chia.net/";
+ license = licenses.asl20;
+ maintainers = teams.chia.members;
+ };
+}
diff --git a/pkgs/development/python-modules/chiapos/dont_fetch_dependencies.patch b/pkgs/development/python-modules/chiapos/dont_fetch_dependencies.patch
new file mode 100644
index 000000000000..ca18fd292ca8
--- /dev/null
+++ b/pkgs/development/python-modules/chiapos/dont_fetch_dependencies.patch
@@ -0,0 +1,31 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 9b4a2f5..86f849c 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -18,22 +18,19 @@ 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)
+
+ FetchContent_Declare(
+ cxxopts
+- GIT_REPOSITORY https://github.com/jarro2783/cxxopts.git
+- GIT_TAG v2.2.1
++ SOURCE_DIR @cxxopts@
+ )
+ FetchContent_MakeAvailable(cxxopts)
+
+ FetchContent_Declare(
+ gulrak
+- GIT_REPOSITORY https://github.com/gulrak/filesystem.git
+- GIT_TAG v1.5.4
++ SOURCE_DIR @ghc_filesystem@
+ )
+ FetchContent_MakeAvailable(gulrak)
+
+