nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ stdenv
2, lib
3, fetchFromGitHub
4, arpack
5, bison
6, blas
7, cmake
8, flex
9, fop
10, glpk
11, gmp
12, lapack
13, libxml2
14, libxslt
15, llvmPackages
16, pkg-config
17, plfit
18, python3
19, sourceHighlight
20, xmlto
21}:
22
23assert (blas.isILP64 == lapack.isILP64 &&
24 blas.isILP64 == arpack.isILP64 &&
25 !blas.isILP64);
26
27stdenv.mkDerivation rec {
28 pname = "igraph";
29 version = "0.10.4";
30
31 src = fetchFromGitHub {
32 owner = "igraph";
33 repo = pname;
34 rev = version;
35 hash = "sha256-LsTOxUktGZcp46Ec9QH3+9C+VADMYTZZCjKF1gp36xk=";
36 };
37
38 postPatch = ''
39 echo "${version}" > IGRAPH_VERSION
40 '';
41
42 outputs = [ "out" "dev" "doc" ];
43
44 nativeBuildInputs = [
45 bison
46 cmake
47 flex
48 fop
49 libxml2
50 libxslt
51 pkg-config
52 python3
53 sourceHighlight
54 xmlto
55 ];
56
57 buildInputs = [
58 arpack
59 blas
60 glpk
61 gmp
62 lapack
63 libxml2
64 plfit
65 ] ++ lib.optionals stdenv.cc.isClang [
66 llvmPackages.openmp
67 ];
68
69 cmakeFlags = [
70 "-DIGRAPH_USE_INTERNAL_BLAS=OFF"
71 "-DIGRAPH_USE_INTERNAL_LAPACK=OFF"
72 "-DIGRAPH_USE_INTERNAL_ARPACK=OFF"
73 "-DIGRAPH_USE_INTERNAL_GLPK=OFF"
74 "-DIGRAPH_USE_INTERNAL_GMP=OFF"
75 "-DIGRAPH_USE_INTERNAL_PLFIT=OFF"
76 "-DIGRAPH_GLPK_SUPPORT=ON"
77 "-DIGRAPH_GRAPHML_SUPPORT=ON"
78 "-DIGRAPH_OPENMP_SUPPORT=ON"
79 "-DIGRAPH_ENABLE_LTO=AUTO"
80 "-DIGRAPH_ENABLE_TLS=ON"
81 "-DBUILD_SHARED_LIBS=ON"
82 ];
83
84 doCheck = true;
85
86 postInstall = ''
87 mkdir -p "$out/share"
88 cp -r doc "$out/share"
89 '';
90
91 postFixup = lib.optionalString stdenv.isDarwin ''
92 install_name_tool -change libblas.dylib ${blas}/lib/libblas.dylib $out/lib/libigraph.dylib
93 '';
94
95 meta = with lib; {
96 description = "C library for complex network analysis and graph theory";
97 homepage = "https://igraph.org/";
98 changelog = "https://github.com/igraph/igraph/blob/${src.rev}/CHANGELOG.md";
99 license = licenses.gpl2Plus;
100 platforms = platforms.all;
101 maintainers = with maintainers; [ MostAwesomeDude dotlambda ];
102 };
103}