about summary refs log tree commit diff
path: root/pkgs/development/python-modules/chiapos
diff options
context:
space:
mode:
authorLouis Bettens <louis@bettens.info>2021-05-09 00:56:08 +0200
committerJonathan Ringer <jonringer@users.noreply.github.com>2021-05-19 14:10:03 -0700
commita8d87bf2e32a11cf9656138b24220821bb60d82c (patch)
treee616d3faf01fe842ed6a55629ec88ff632b67d62 /pkgs/development/python-modules/chiapos
parentbdad35184221b0638fdc0228628209dde390399e (diff)
pythonPackages.chiapos: init at 1.0.1
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 0000000000000..1faf5a94f8ccb
--- /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 0000000000000..ca18fd292ca8e
--- /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)
+ 
+