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