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.10.0";
16 pyproject = true;
17
18 src = fetchPypi {
19 inherit pname version;
20 hash = "sha256-qKIQUFj9fbVHGL5TxIcVpQkQUAsQ/wuPU4BDTmnBChA=";
21 };
22
23 cargoDeps = rustPlatform.fetchCargoVendor {
24 inherit pname version src;
25 hash = "sha256-Ohbeavkayl6vMyYX9kVVLRddvVB9gWOxfzdWAOg+gac=";
26 };
27
28 nativeBuildInputs = with rustPlatform; [
29 cargoSetupHook
30 maturinBuildHook
31 ];
32
33 buildInputs = lib.optional stdenv.hostPlatform.isDarwin libiconv;
34
35 propagatedBuildInputs = [
36 numpy
37 scipy
38 ];
39
40 pythonImportsCheck = [ "clarabel" ];
41
42 # no tests but run the same examples as .github/workflows/pypi.yaml
43 checkPhase = ''
44 runHook preCheck
45 python examples/python/example_sdp.py
46 python examples/python/example_qp.py
47 runHook postCheck
48 '';
49
50 passthru.updateScript = nix-update-script { };
51
52 meta = {
53 changelog = "https://github.com/oxfordcontrol/Clarabel.rs/releases/tag/v${version}/CHANGELOG.md";
54 description = "Conic Interior Point Solver";
55 homepage = "https://github.com/oxfordcontrol/Clarabel.rs";
56 license = lib.licenses.asl20;
57 maintainers = [ ];
58 };
59}