aboutsummaryrefslogtreecommitdiff
path: root/infra/libkookie/nixpkgs/pkgs/development/python-modules/retworkx/default.nix
diff options
context:
space:
mode:
authorMx Kookie <kookie@spacekookie.de>2020-10-31 19:35:09 +0100
committerMx Kookie <kookie@spacekookie.de>2020-10-31 19:35:09 +0100
commitc4625b175f8200f643fd6e11010932ea44c78433 (patch)
treebce3f89888c8ac3991fa5569a878a9eab6801ccc /infra/libkookie/nixpkgs/pkgs/development/python-modules/retworkx/default.nix
parent49f735974dd103039ddc4cb576bb76555164a9e7 (diff)
parentd661aa56a8843e991261510c1bb28fdc2f6975ae (diff)
Add 'infra/libkookie/' from commit 'd661aa56a8843e991261510c1bb28fdc2f6975ae'
git-subtree-dir: infra/libkookie git-subtree-mainline: 49f735974dd103039ddc4cb576bb76555164a9e7 git-subtree-split: d661aa56a8843e991261510c1bb28fdc2f6975ae
Diffstat (limited to 'infra/libkookie/nixpkgs/pkgs/development/python-modules/retworkx/default.nix')
-rw-r--r--infra/libkookie/nixpkgs/pkgs/development/python-modules/retworkx/default.nix69
1 files changed, 69 insertions, 0 deletions
diff --git a/infra/libkookie/nixpkgs/pkgs/development/python-modules/retworkx/default.nix b/infra/libkookie/nixpkgs/pkgs/development/python-modules/retworkx/default.nix
new file mode 100644
index 000000000000..49e4b1c2fc34
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/development/python-modules/retworkx/default.nix
@@ -0,0 +1,69 @@
+{ lib
+, rustPlatform
+, python
+, fetchpatch
+, fetchFromGitHub
+, pipInstallHook
+, maturin
+, pip
+ # Check inputs
+, pytestCheckHook
+, numpy
+}:
+
+rustPlatform.buildRustPackage rec {
+ pname = "retworkx";
+ version = "0.4.0";
+
+ src = fetchFromGitHub {
+ owner = "Qiskit";
+ repo = "retworkx";
+ rev = version;
+ sha256 = "1xqp6d39apkjvd0ad9vw81cp2iqzhpagfa4p171xqm3bwfn2imdc";
+ };
+
+ cargoSha256 = "0bma0l14jv5qhcsxck7vw3ak1w3c8v84cq4hii86i4iqk523zns5";
+ cargoPatches = [
+ ( fetchpatch {
+ name = "retworkx-cargo-lock.patch";
+ url = "https://github.com/Qiskit/retworkx/commit/a02fd33d357a92dbe9530696a6d85aa59fe8a5b9.patch";
+ sha256 = "0gvxr1nqp9ll4skfks4p4d964pshal25kb1nbfzhpyipnzddizr5";
+ } )
+ ];
+
+ propagatedBuildInputs = [ python ];
+
+ nativeBuildInputs = [ pipInstallHook maturin pip ];
+
+ # Need to check AFTER python wheel is installed (b/c using Rust Build, not buildPythonPackage)
+ doCheck = false;
+ doInstallCheck = true;
+
+ buildPhase = ''
+ runHook preBuild
+ maturin build --release --manylinux off --strip --interpreter ${python.interpreter}
+ runHook postBuild
+ '';
+
+ installPhase = ''
+ install -Dm644 -t dist target/wheels/*.whl
+ pipInstallPhase
+ '';
+
+ installCheckInputs = [ pytestCheckHook numpy ];
+ preCheck = ''
+ export TESTDIR=$(mktemp -d)
+ cp -r $TMP/$sourceRoot/tests $TESTDIR
+ pushd $TESTDIR
+ '';
+ postCheck = "popd";
+
+ meta = with lib; {
+ description = "A python graph library implemented in Rust.";
+ homepage = "https://retworkx.readthedocs.io/en/latest/index.html";
+ downloadPage = "https://github.com/Qiskit/retworkx/releases";
+ changelog = "https://github.com/Qiskit/retworkx/releases/tag/${version}";
+ license = licenses.asl20;
+ maintainers = with maintainers; [ drewrisinger ];
+ };
+}