nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 fontconfig,
6 gfortran,
7 pkg-config,
8 blas,
9 bzip2,
10 cbc,
11 clp,
12 doxygen,
13 graphviz,
14 ipopt,
15 lapack,
16 libamplsolver,
17 osi,
18 texliveSmall,
19 zlib,
20}:
21
22assert (!blas.isILP64) && (!lapack.isILP64);
23
24stdenv.mkDerivation rec {
25 pname = "bonmin";
26 version = "1.8.9";
27
28 src = fetchFromGitHub {
29 owner = "coin-or";
30 repo = "Bonmin";
31 rev = "releases/${version}";
32 sha256 = "sha256-nqjAQ1NdNJ/T4p8YljEWRt/uy2aDwyBeAsag0TmRc5Q=";
33 };
34
35 __structuredAttrs = true;
36
37 nativeBuildInputs = [
38 doxygen
39 gfortran
40 graphviz
41 pkg-config
42 texliveSmall
43 ];
44 buildInputs = [
45 blas
46 bzip2
47 cbc
48 clp
49 ipopt
50 lapack
51 libamplsolver
52 osi
53 zlib
54 ];
55
56 configureFlags = lib.optionals stdenv.hostPlatform.isDarwin [
57 "--with-asl-lib=-lipoptamplinterface -lamplsolver"
58 ];
59
60 # Fix doc install. Should not be necessary after next release
61 # ref https://github.com/coin-or/Bonmin/commit/4f665bc9e489a73cb867472be9aea518976ecd28
62 sourceRoot = "${src.name}/Bonmin";
63
64 # Fontconfig error: Cannot load default config file: No such file: (null)
65 env.FONTCONFIG_FILE = "${fontconfig.out}/etc/fonts/fonts.conf";
66
67 # Fontconfig error: No writable cache directories
68 preBuild = "export XDG_CACHE_HOME=$(mktemp -d)";
69
70 doCheck = true;
71 checkTarget = "test";
72
73 # ignore one failing test
74 postPatch = lib.optionalString stdenv.hostPlatform.isDarwin ''
75 substituteInPlace test/Makefile.in --replace-fail \
76 "./unitTest\''$(EXEEXT)" \
77 ""
78 '';
79
80 # install documentation
81 postInstall = "make install-doxygen-docs";
82
83 meta = {
84 description = "Open-source code for solving general MINLP (Mixed Integer NonLinear Programming) problems";
85 mainProgram = "bonmin";
86 homepage = "https://github.com/coin-or/Bonmin";
87 license = lib.licenses.epl10;
88 platforms = lib.platforms.unix;
89 maintainers = with lib.maintainers; [ aanderse ];
90 };
91}