summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
authorSandro <sandro.jaeckel@gmail.com>2021-08-02 14:39:38 +0000
committerGitHub <noreply@github.com>2021-08-02 14:39:38 +0000
commitcd9938d126b5818b2cbf42936acea140df997718 (patch)
treeb4aa13e600bb09946f8456c208438839d539b122 /pkgs
parentd0e0c93c22e64d0828630d07daf3840b42f0f59e (diff)
parenta6581d356df2f9e497e4413e011659f0fc8b0115 (diff)
downloadnixpkgs-cd9938d126b5818b2cbf42936acea140df997718.tar
nixpkgs-cd9938d126b5818b2cbf42936acea140df997718.tar.gz
nixpkgs-cd9938d126b5818b2cbf42936acea140df997718.tar.bz2
nixpkgs-cd9938d126b5818b2cbf42936acea140df997718.tar.lz
nixpkgs-cd9938d126b5818b2cbf42936acea140df997718.tar.xz
nixpkgs-cd9938d126b5818b2cbf42936acea140df997718.tar.zst
nixpkgs-cd9938d126b5818b2cbf42936acea140df997718.zip
Merge pull request #132215 from ilyakooo0/iko/chia-plotter
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/applications/blockchains/chia-plotter/default.nix65
-rw-r--r--pkgs/applications/blockchains/chia-plotter/dont_fetch_dependencies.patch50
-rw-r--r--pkgs/top-level/all-packages.nix2
3 files changed, 117 insertions, 0 deletions
diff --git a/pkgs/applications/blockchains/chia-plotter/default.nix b/pkgs/applications/blockchains/chia-plotter/default.nix
new file mode 100644
index 00000000000..39f2e3cb0ed
--- /dev/null
+++ b/pkgs/applications/blockchains/chia-plotter/default.nix
@@ -0,0 +1,65 @@
+{ lib
+, fetchFromGitHub
+, stdenv
+, libsodium
+, cmake
+, substituteAll
+, pythonPackages
+}:
+
+stdenv.mkDerivation {
+  pname = "chia-plotter";
+  version = "unstable-2021-07-12";
+
+  src = fetchFromGitHub {
+    owner = "madMAx43v3r";
+    repo = "chia-plotter";
+    rev = "974d6e5f1440f68c48492122ca33828a98864dfc";
+    sha256 = "0dliswvqmi3wq9w8jp0sb0z74n5k37608sig6r60z206g2bwhjja";
+    fetchSubmodules = true;
+  };
+
+  patches = [
+    # prevent CMake from trying to get libraries on the Internet
+    (substituteAll {
+      src = ./dont_fetch_dependencies.patch;
+      pybind11_src = pythonPackages.pybind11.src;
+      relic_src = fetchFromGitHub {
+        owner = "relic-toolkit";
+        repo = "relic";
+        rev = "1885ae3b681c423c72b65ce1fe70910142cf941c";
+        hash = "sha256-tsSZTcssl8t7Nqdex4BesgQ+ACPgTdtHnJFvS9josN0=";
+      };
+    })
+  ];
+
+  nativeBuildInputs = [ cmake ];
+
+  buildInputs = [ libsodium ];
+
+  # These flags come from the upstream build script:
+  # https://github.com/madMAx43v3r/chia-plotter/blob/974d6e5f1440f68c48492122ca33828a98864dfc/make_devel.sh#L7
+  CXXFLAGS = "-O3 -fmax-errors=1";
+  cmakeFlags = [
+    "-DARITH=easy"
+    "-DBUILD_BLS_PYTHON_BINDINGS=false"
+    "-DBUILD_BLS_TESTS=false"
+    "-DBUILD_BLS_BENCHMARKS=false"
+  ];
+
+  installPhase = ''
+    runHook preInstall
+
+    install -D -m 755 chia_plot $out/bin/chia_plot
+
+    runHook postInstall
+  '';
+
+  meta = with lib; {
+    homepage = "https://github.com/madMAx43v3r/chia-plotter";
+    description = "New implementation of a chia plotter which is designed as a processing pipeline";
+    license = licenses.gpl3Only;
+    platforms = platforms.linux;
+    maintainers = with maintainers; [ ilyakooo0 ];
+  };
+}
diff --git a/pkgs/applications/blockchains/chia-plotter/dont_fetch_dependencies.patch b/pkgs/applications/blockchains/chia-plotter/dont_fetch_dependencies.patch
new file mode 100644
index 00000000000..05486473eef
--- /dev/null
+++ b/pkgs/applications/blockchains/chia-plotter/dont_fetch_dependencies.patch
@@ -0,0 +1,50 @@
+diff --git a/lib/bls-signatures/python-bindings/CMakeLists.txt b/lib/bls-signatures/python-bindings/CMakeLists.txt
+index 255e3bb..5f99c3a 100644
+--- a/lib/bls-signatures/python-bindings/CMakeLists.txt
++++ b/lib/bls-signatures/python-bindings/CMakeLists.txt
+@@ -6,8 +6,7 @@ include(FetchContent)
+ 
+ FetchContent_Declare(
+   pybind11
+-  GIT_REPOSITORY https://github.com/pybind/pybind11.git
+-  GIT_TAG        v2.6.2
++  SOURCE_DIR @pybind11_src@
+ )
+ FetchContent_MakeAvailable(pybind11 relic)
+ 
+diff --git a/lib/bls-signatures/src/CMakeLists.txt b/lib/bls-signatures/src/CMakeLists.txt
+index b762b5d..e06073b 100644
+--- a/lib/bls-signatures/src/CMakeLists.txt
++++ b/lib/bls-signatures/src/CMakeLists.txt
+@@ -4,18 +4,11 @@ set (CMAKE_CXX_STANDARD 17)
+ # CMake 3.14+
+ include(FetchContent)
+ 
+-if (DEFINED ENV{RELIC_MAIN})
+-  set(RELIC_GIT_TAG "origin/main")
+-else ()
+-  set(RELIC_GIT_TAG "1885ae3b681c423c72b65ce1fe70910142cf941c")
+-endif ()
+-
+ message(STATUS "Relic will be built from: ${RELIC_GIT_TAG}")
+ 
+ FetchContent_Declare(
+   relic
+-  GIT_REPOSITORY https://github.com/relic-toolkit/relic.git
+-  GIT_TAG        ${RELIC_GIT_TAG}
++  SOURCE_DIR @relic_src@
+ )
+ FetchContent_MakeAvailable(relic)
+ 
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 970ec74..948441a 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -38,6 +38,7 @@ include_directories(
+ 	${BLAKE3_PATH}
+ 	${CMAKE_BINARY_DIR}/_deps/relic-src/include
+ 	${CMAKE_BINARY_DIR}/_deps/relic-build/include
++     @relic_src@/include
+ )
+ 
+ IF (WIN32)
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index c50bbd59043..6de898c2e42 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -28649,6 +28649,8 @@ in
 
   chia = callPackage ../applications/blockchains/chia { };
 
+  chia-plotter = callPackage ../applications/blockchains/chia-plotter { };
+
   clightning = callPackage ../applications/blockchains/clightning { };
 
   bitcoin-abc  = libsForQt5.callPackage ../applications/blockchains/bitcoin-abc {