forked from nix-community/nur-packages-template
-
Notifications
You must be signed in to change notification settings - Fork 2
/
default.nix
138 lines (123 loc) · 3.3 KB
/
default.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
{ lib
, pythonOlder
, buildPythonPackage
, fetchFromGitHub
# C Inputs
, blas
, openblas
, catch2
, cmake
, cython
, fmt
, muparserx
, ninja
, nlohmann_json
, spdlog
# Python Inputs
, cvxpy
, numpy
, pybind11
, scikit-build
# Check Inputs
, pytestCheckHook
, ddt
, fixtures
, qiskit-terra
}:
buildPythonPackage rec {
pname = "qiskit-aer";
version = "0.8.1";
format = "pyproject";
disabled = pythonOlder "3.6";
src = fetchFromGitHub {
owner = "Qiskit";
repo = "qiskit-aer";
rev = version;
sha256 = "1f1s2jm8y13plkmpdnm2jsji5rvzd72f3q186v1g2ql21sl2i07g";
};
# The default check for the dl library will erroneously fail (and building with it w/ buildInputs = [... glibc ] fails too).
# So we use the standard ${CMAKE_DL_LIBS}, which they should have used in the first place...
# Builds fine with this.
postPatch = ''
substituteInPlace CMakeLists.txt --replace "find_library(DL_LIB NAMES dl)" ""
substituteInPlace CMakeLists.txt --replace "''${DL_LIB}" "''${CMAKE_DL_LIBS}"
substituteInPlace setup.py \
--replace "'cmake!=3.17,!=3.17.0'," "" \
--replace "'pybind11', min_version='2.6'" "'pybind11'" \
--replace "pybind11>=2.6" "pybind11" \
--replace "scikit-build>=0.11.0" "scikit-build" \
--replace "min_version='0.11.0'" ""
'';
nativeBuildInputs = [
cmake
ninja
scikit-build
];
buildInputs = [
(if (lib.versionAtLeast lib.version "20.09") then blas else openblas )
catch2
nlohmann_json
fmt
muparserx
spdlog
];
propagatedBuildInputs = [
cvxpy
cython # generates some cython files at runtime that need to be cython-ized
numpy
pybind11
];
DISABLE_CONAN=1;
dontUseCmakeConfigure = true;
# *** Testing ***
pythonImportsCheck = [
"qiskit.providers.aer"
"qiskit.providers.aer.backends.qasm_simulator"
"qiskit.providers.aer.backends.controller_wrappers" # Checks C++ files built correctly. Only exists if built & moved to output
];
disabledTests = [
# these fail for some builds. Haven't been able to reproduce error locally.
"test_kraus_gate_noise"
"test_backend_method_clifford_circuits_and_kraus_noise"
"test_backend_method_nonclifford_circuit_and_kraus_noise"
"test_kraus_noise_fusion"
# Slow tests
"test_paulis_1_and_2_qubits"
"test_3d_oscillator"
"_057"
"_136"
"_137"
"_139"
"_138"
"_140"
"_141"
"_143"
"_144"
"test_sparse_output_probabilities"
"test_reset_2_qubit"
];
checkInputs = [
pytestCheckHook
ddt
fixtures
qiskit-terra
];
dontUseSetuptoolsCheck = true; # Otherwise runs tests twice
preCheck = ''
# Tests include a compiled "circuit" which is auto-built in $HOME
export HOME=$(mktemp -d)
# move tests b/c by default try to find (missing) cython-ized code in /build/source dir
cp -r $TMP/$sourceRoot/test $HOME
# Add qiskit-aer compiled files to cython include search
pushd $HOME
'';
postCheck = "popd";
meta = with lib; {
description = "High performance simulators for Qiskit";
homepage = "https://qiskit.org/aer";
downloadPage = "https://github.com/QISKit/qiskit-aer/releases";
changelog = "https://qiskit.org/documentation/release_notes.html";
license = licenses.asl20;
maintainers = with maintainers; [ drewrisinger ];
};
}