From a8d87bf2e32a11cf9656138b24220821bb60d82c Mon Sep 17 00:00:00 2001 From: Louis Bettens Date: Sun, 9 May 2021 00:56:08 +0200 Subject: [PATCH] pythonPackages.chiapos: init at 1.0.1 --- .../python-modules/chiapos/default.nix | 48 +++++++++++++++++++ .../chiapos/dont_fetch_dependencies.patch | 31 ++++++++++++ pkgs/top-level/python-packages.nix | 2 + 3 files changed, 81 insertions(+) create mode 100644 pkgs/development/python-modules/chiapos/default.nix create mode 100644 pkgs/development/python-modules/chiapos/dont_fetch_dependencies.patch diff --git a/pkgs/development/python-modules/chiapos/default.nix b/pkgs/development/python-modules/chiapos/default.nix new file mode 100644 index 00000000000..1faf5a94f8c --- /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 00000000000..ca18fd292ca --- /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) + + diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 7bd3aa5da99..e61249e7257 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -1345,6 +1345,8 @@ in { chevron = callPackage ../development/python-modules/chevron { }; + chiapos = callPackage ../development/python-modules/chiapos { }; + chirpstack-api = callPackage ../development/python-modules/chirpstack-api { }; ci-info = callPackage ../development/python-modules/ci-info { };