nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 stdenv,
3 lib,
4 fetchFromGitLab,
5 cmake,
6 perl,
7 python3,
8 boost,
9 fortranSupport ? false,
10 gfortran,
11 buildDocumentation ? false,
12 fig2dev,
13 ghostscript,
14 doxygen,
15 buildJavaBindings ? false,
16 openjdk,
17 buildPythonBindings ? true,
18 python3Packages,
19 modelCheckingSupport ? false,
20 libunwind,
21 libevent,
22 elfutils, # Inside elfutils: libelf and libdw
23 bmfSupport ? true,
24 eigen,
25 minimalBindings ? false,
26 debug ? false,
27 optimize ? (!debug),
28 moreTests ? false,
29 withoutBin ? false,
30}:
31
32stdenv.mkDerivation rec {
33 pname = "simgrid";
34 version = "4.0";
35
36 src = fetchFromGitLab {
37 domain = "framagit.org";
38 owner = "simgrid";
39 repo = "simgrid";
40 rev = "v${version}";
41 sha256 = "sha256-wRyUeXx8mvrwBLoj8nHNdjJuUjYfWoXuZS1+E7lmCLc=";
42 };
43
44 propagatedBuildInputs = [ boost ];
45 nativeBuildInputs = [
46 cmake
47 perl
48 python3
49 ]
50 ++ lib.optionals fortranSupport [ gfortran ]
51 ++ lib.optionals buildJavaBindings [ openjdk ]
52 ++ lib.optionals buildPythonBindings [ python3Packages.pybind11 ]
53 ++ lib.optionals buildDocumentation [
54 fig2dev
55 ghostscript
56 doxygen
57 ]
58 ++ lib.optionals bmfSupport [ eigen ]
59 ++ lib.optionals modelCheckingSupport [
60 libunwind
61 libevent
62 elfutils
63 ];
64
65 outputs = [ "out" ] ++ lib.optionals buildPythonBindings [ "python" ];
66
67 # "Release" does not work. non-debug mode is Debug compiled with optimization
68 cmakeBuildType = "Debug";
69
70 cmakeFlags = [
71 (lib.cmakeBool "enable_documentation" buildDocumentation)
72 (lib.cmakeBool "enable_java" buildJavaBindings)
73 (lib.cmakeBool "enable_python" buildPythonBindings)
74 (lib.cmakeFeature "SIMGRID_PYTHON_LIBDIR" "./") # prevents CMake to install in ${python3} dir
75 (lib.cmakeBool "enable_msg" buildJavaBindings)
76 (lib.cmakeBool "enable_fortran" fortranSupport)
77 (lib.cmakeBool "enable_model-checking" modelCheckingSupport)
78 (lib.cmakeBool "enable_ns3" false)
79 (lib.cmakeBool "enable_lua" false)
80 (lib.cmakeBool "enable_lib_in_jar" false)
81 (lib.cmakeBool "enable_maintainer_mode" false)
82 (lib.cmakeBool "enable_mallocators" true)
83 (lib.cmakeBool "enable_debug" true)
84 (lib.cmakeBool "enable_smpi" true)
85 (lib.cmakeBool "minimal-bindings" minimalBindings)
86 (lib.cmakeBool "enable_smpi_ISP_testsuite" moreTests)
87 (lib.cmakeBool "enable_smpi_MPICH3_testsuite" moreTests)
88 (lib.cmakeBool "enable_compile_warnings" false)
89 (lib.cmakeBool "enable_compile_optimizations" optimize)
90 (lib.cmakeBool "enable_lto" optimize)
91 # RPATH of binary /nix/store/.../bin/... contains a forbidden reference to /build/
92 (lib.cmakeBool "CMAKE_SKIP_BUILD_RPATH" optimize)
93 ];
94
95 makeFlags = lib.optional debug "VERBOSE=1";
96
97 # needed to run tests and to ensure correct shabangs in output scripts
98 preBuild = ''
99 patchShebangs ..
100 '';
101
102 # needed by tests (so libsimgrid.so is found)
103 preConfigure = ''
104 export LD_LIBRARY_PATH="$PWD/build/lib"
105 '';
106
107 doCheck = true;
108 preCheck = ''
109 # prevent the execution of tests known to fail
110 cat <<EOW >CTestCustom.cmake
111 SET(CTEST_CUSTOM_TESTS_IGNORE smpi-replay-multiple)
112 EOW
113
114 # make sure tests are built in parallel (this can be long otherwise)
115 make tests -j $NIX_BUILD_CORES
116 '';
117
118 postInstall =
119 lib.optionalString withoutBin ''
120 # remove bin from output if requested.
121 # having a specific bin output would be cleaner but it does not work currently (circular references)
122 rm -rf $out/bin
123 ''
124 + lib.optionalString buildPythonBindings ''
125 # manually install the python binding if requested.
126 mkdir -p $python/lib/python${lib.versions.majorMinor python3.version}/site-packages/
127 cp ./lib/simgrid.cpython*.so $python/lib/python${lib.versions.majorMinor python3.version}/site-packages/
128 '';
129
130 # improve debuggability if requested
131 hardeningDisable = lib.optionals debug [ "fortify" ];
132 dontStrip = debug;
133
134 meta = {
135 description = "Framework for the simulation of distributed applications";
136 longDescription = ''
137 SimGrid is a toolkit that provides core functionalities for the
138 simulation of distributed applications in heterogeneous distributed
139 environments. The specific goal of the project is to facilitate
140 research in the area of distributed and parallel application
141 scheduling on distributed computing platforms ranging from simple
142 network of workstations to Computational Grids.
143 '';
144 homepage = "https://simgrid.org/";
145 license = lib.licenses.lgpl2Plus;
146 maintainers = with lib.maintainers; [
147 mickours
148 mpoquet
149 ];
150 platforms = lib.platforms.all;
151 broken = stdenv.hostPlatform.isDarwin;
152 };
153}