1{ lib
2, pythonOlder
3, buildPythonPackage
4, fetchFromGitHub
5, fetchpatch
6, cmake
7, cvxpy
8, cython
9, muparserx
10, ninja
11, nlohmann_json
12, numpy
13, openblas
14, pybind11
15, scikit-build
16, spdlog
17 # Check Inputs
18, qiskit-terra
19, pytestCheckHook
20, python
21}:
22
23buildPythonPackage rec {
24 pname = "qiskit-aer";
25 version = "0.6.1";
26
27 disabled = pythonOlder "3.5";
28
29 src = fetchFromGitHub {
30 owner = "Qiskit";
31 repo = "qiskit-aer";
32 rev = version;
33 sha256 = "1fnv11diis0as8zcc57mamz0gbjd6vj7nw3arxzvwa77ja803sr4";
34 };
35
36 nativeBuildInputs = [
37 cmake
38 ninja
39 scikit-build
40 ];
41
42 buildInputs = [
43 openblas
44 spdlog
45 nlohmann_json
46 muparserx
47 ];
48
49 propagatedBuildInputs = [
50 cvxpy
51 cython # generates some cython files at runtime that need to be cython-ized
52 numpy
53 pybind11
54 ];
55
56 patches = [
57 # TODO: remove in favor of qiskit-aer PR #877 patch once accepted/stable
58 ./remove-conan-install.patch
59 ];
60
61 dontUseCmakeConfigure = true;
62
63 cmakeFlags = [
64 "-DBUILD_TESTS=True"
65 "-DAER_THRUST_BACKEND=OMP"
66 ];
67
68 # *** Testing ***
69
70 pythonImportsCheck = [
71 "qiskit.providers.aer"
72 "qiskit.providers.aer.backends.qasm_simulator"
73 "qiskit.providers.aer.backends.controller_wrappers" # Checks C++ files built correctly. Only exists if built & moved to output
74 ];
75 checkInputs = [
76 qiskit-terra
77 pytestCheckHook
78 ];
79 dontUseSetuptoolsCheck = true; # Otherwise runs tests twice
80
81 preCheck = ''
82 # Tests include a compiled "circuit" which is auto-built in $HOME
83 export HOME=$(mktemp -d)
84 # move tests b/c by default try to find (missing) cython-ized code in /build/source dir
85 cp -r $TMP/$sourceRoot/test $HOME
86
87 # Add qiskit-aer compiled files to cython include search
88 pushd $HOME
89 '';
90 postCheck = ''
91 popd
92 '';
93
94 meta = with lib; {
95 description = "High performance simulators for Qiskit";
96 homepage = "https://qiskit.org/aer";
97 downloadPage = "https://github.com/QISKit/qiskit-aer/releases";
98 changelog = "https://qiskit.org/documentation/release_notes.html";
99 license = licenses.asl20;
100 maintainers = with maintainers; [ drewrisinger ];
101 };
102}