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, suitesparse
21, xmlto
22}:
23
24stdenv.mkDerivation rec {
25 pname = "igraph";
26 version = "0.9.8";
27
28 src = fetchFromGitHub {
29 owner = "igraph";
30 repo = pname;
31 rev = version;
32 hash = "sha256-t0GC6FVFcbVbmZ74XNSPCRRUsSr1Z8rRw6Rf++qk4I0=";
33 };
34
35 postPatch = ''
36 echo "${version}" > IGRAPH_VERSION
37 '' + lib.optionalString stdenv.isAarch64 ''
38 # https://github.com/igraph/igraph/issues/1694
39 substituteInPlace tests/CMakeLists.txt \
40 --replace "igraph_scg_grouping3" "" \
41 --replace "igraph_scg_semiprojectors2" ""
42 '';
43
44 outputs = [ "out" "dev" "doc" ];
45
46 nativeBuildInputs = [
47 bison
48 cmake
49 flex
50 fop
51 libxml2
52 libxslt
53 pkg-config
54 python3
55 sourceHighlight
56 xmlto
57 ];
58
59 buildInputs = [
60 arpack
61 blas
62 glpk
63 gmp
64 lapack
65 libxml2
66 plfit
67 suitesparse
68 ] ++ lib.optionals stdenv.cc.isClang [
69 llvmPackages.openmp
70 ];
71
72 cmakeFlags = [
73 "-DIGRAPH_USE_INTERNAL_BLAS=OFF"
74 "-DIGRAPH_USE_INTERNAL_LAPACK=OFF"
75 "-DIGRAPH_USE_INTERNAL_ARPACK=OFF"
76 "-DIGRAPH_USE_INTERNAL_GLPK=OFF"
77 "-DIGRAPH_USE_INTERNAL_CXSPARSE=OFF"
78 "-DIGRAPH_USE_INTERNAL_GMP=OFF"
79 "-DIGRAPH_USE_INTERNAL_PLFIT=OFF"
80 "-DIGRAPH_GLPK_SUPPORT=ON"
81 "-DIGRAPH_GRAPHML_SUPPORT=ON"
82 "-DIGRAPH_OPENMP_SUPPORT=ON"
83 "-DIGRAPH_ENABLE_LTO=AUTO"
84 "-DIGRAPH_ENABLE_TLS=ON"
85 "-DBUILD_SHARED_LIBS=ON"
86 ];
87
88 doCheck = true;
89
90 # needed to find libigraph, and liblas on darwin
91 preCheck = if stdenv.isDarwin then ''
92 export DYLD_LIBRARY_PATH="${lib.makeLibraryPath [ blas ]}:$PWD/src"
93 '' else ''
94 export LD_LIBRARY_PATH="$PWD/src"
95 '';
96
97 postInstall = ''
98 mkdir -p "$out/share"
99 cp -r doc "$out/share"
100 '';
101
102 postFixup = lib.optionalString stdenv.isDarwin ''
103 install_name_tool -change libblas.dylib ${blas}/lib/libblas.dylib $out/lib/libigraph.dylib
104 '';
105
106 meta = with lib; {
107 description = "The network analysis package";
108 homepage = "https://igraph.org/";
109 changelog = "https://github.com/igraph/igraph/blob/${src.rev}/CHANGELOG.md";
110 license = licenses.gpl2Plus;
111 platforms = platforms.all;
112 maintainers = with maintainers; [ MostAwesomeDude dotlambda ];
113 };
114}