1{
2 blas,
3 cmake,
4 fetchFromGitHub,
5 fetchpatch,
6 lib,
7 pythonSupport ? false,
8 python3Packages,
9 stdenv,
10}:
11
12stdenv.mkDerivation (finalAttrs: {
13 pname = "trlib";
14 version = "0.4";
15
16 src = fetchFromGitHub {
17 owner = "felixlen";
18 repo = "trlib";
19 rev = finalAttrs.version;
20 hash = "sha256-pD2MGsIQgMO4798Gp9oLprKhmV0lcjgtUHh1rvEjSIY=";
21 };
22
23 patches = [
24 # update use of distutils
25 # This PR was merged upstream, so the patch can be removed on next release
26 (fetchpatch {
27 name = "python312-support.patch";
28 url = "https://github.com/felixlen/trlib/pull/26/commits/6b72f3b2afebee4ae179bc760f93b16c60fd72d8.patch";
29 hash = "sha256-+6iiALFhMSiE44kpkDrhwrYt4miHlPkiffRZAgsM1Jo=";
30 })
31 ];
32
33 nativeBuildInputs = [ cmake ];
34 buildInputs = [
35 blas
36 ]
37 ++ lib.optionals pythonSupport [
38 python3Packages.cython
39 python3Packages.numpy
40 ];
41
42 cmakeFlags = [ (lib.cmakeBool "TRLIB_BUILD_PYTHON3" pythonSupport) ];
43
44 meta = {
45 description = "Trust Region Subproblem Solver Library";
46 homepage = "https://github.com/felixlen/trlib";
47 license = lib.licenses.mit;
48 maintainers = with lib.maintainers; [ nim65s ];
49 };
50})