1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 fetchPypi,
6 rustPlatform,
7 libiconv,
8 numpy,
9 scipy,
10 nix-update-script,
11}:
12
13buildPythonPackage rec {
14 pname = "clarabel";
15 version = "0.9.0";
16 pyproject = true;
17
18 src = fetchPypi {
19 inherit pname version;
20 hash = "sha256-DW0/6IAL5bS11AqOFL1JJmez5GzF2+N2d85e0l8HGdQ=";
21 };
22
23 cargoDeps = rustPlatform.fetchCargoTarball {
24 inherit src;
25 name = "${pname}-${version}";
26 hash = "sha256-NNvrDXBodrO3bxr4X1HEn5uHmHDJ1s9C70lPv7OkSCo=";
27 };
28
29 nativeBuildInputs = with rustPlatform; [
30 cargoSetupHook
31 maturinBuildHook
32 ];
33
34 buildInputs = lib.optional stdenv.isDarwin libiconv;
35
36 propagatedBuildInputs = [
37 numpy
38 scipy
39 ];
40
41 pythonImportsCheck = [ "clarabel" ];
42
43 # no tests but run the same examples as .github/workflows/pypi.yaml
44 checkPhase = ''
45 runHook preCheck
46 python examples/python/example_sdp.py
47 python examples/python/example_qp.py
48 runHook postCheck
49 '';
50
51 passthru.updateScript = nix-update-script { };
52
53 meta = {
54 changelog = "https://github.com/oxfordcontrol/Clarabel.rs/releases/tag/v${version}/CHANGELOG.md";
55 description = "Conic Interior Point Solver";
56 homepage = "https://github.com/oxfordcontrol/Clarabel.rs";
57 license = lib.licenses.asl20;
58 maintainers = [ ];
59 };
60}