1{ lib
2, fetchFromGitHub
3, stdenv
4, libsodium
5, cmake
6, substituteAll
7, python3Packages
8}:
9
10stdenv.mkDerivation {
11 pname = "chia-plotter";
12 version = "1.1.8";
13
14 src = fetchFromGitHub {
15 owner = "madMAx43v3r";
16 repo = "chia-plotter";
17 rev = "9d7fd929919d1adde6404cb4718a665a81bcef6d";
18 sha256 = "sha256-TMAly+Qof2DHPRHqE1nZuHQaCeMo0jEd8MWy4OlXrcs=";
19 fetchSubmodules = true;
20 };
21
22 patches = [
23 # prevent CMake from trying to get libraries on the Internet
24 (substituteAll {
25 src = ./dont_fetch_dependencies.patch;
26 pybind11_src = python3Packages.pybind11.src;
27 relic_src = fetchFromGitHub {
28 owner = "Chia-Network";
29 repo = "relic";
30 rev = "1d98e5abf3ca5b14fd729bd5bcced88ea70ecfd7";
31 hash = "sha256-IfTD8DvTEXeLUoKe4Ejafb+PEJW5DV/VXRYuutwGQHU=";
32 };
33 sodium_src = fetchFromGitHub {
34 owner = "AmineKhaldi";
35 repo = "libsodium-cmake";
36 rev = "f73a3fe1afdc4e37ac5fe0ddd401bf521f6bba65"; # pinned by upstream
37 sha256 = "sha256-lGz7o6DQVAuEc7yTp8bYS2kwjzHwGaNjugDi1ruRJOA=";
38 fetchSubmodules = true;
39 };
40 })
41 ];
42
43 nativeBuildInputs = [ cmake ];
44
45 buildInputs = [ libsodium ];
46
47 # These flags come from the upstream build script:
48 # https://github.com/madMAx43v3r/chia-plotter/blob/974d6e5f1440f68c48492122ca33828a98864dfc/make_devel.sh#L7
49 CXXFLAGS = "-O3 -fmax-errors=1";
50 cmakeFlags = [
51 "-DARITH=easy"
52 "-DBUILD_BLS_PYTHON_BINDINGS=false"
53 "-DBUILD_BLS_TESTS=false"
54 "-DBUILD_BLS_BENCHMARKS=false"
55 ];
56
57 installPhase = ''
58 runHook preInstall
59
60 install -D -m 755 chia_plot $out/bin/chia_plot
61
62 runHook postInstall
63 '';
64
65 meta = with lib; {
66 homepage = "https://github.com/madMAx43v3r/chia-plotter";
67 description = "New implementation of a chia plotter which is designed as a processing pipeline";
68 license = licenses.gpl3Only;
69 platforms = platforms.linux;
70 maintainers = with maintainers; [ ilyakooo0 ];
71 };
72}