1 { stdenv, lib, fetchFromGitLab, cmake, perl, python3, boost
2 , fortranSupport ? false, gfortran
3 , buildDocumentation ? false, fig2dev, ghostscript, doxygen
4 , buildJavaBindings ? false, openjdk
5 , buildPythonBindings ? true, python3Packages
6 , modelCheckingSupport ? false, libunwind, libevent, elfutils # Inside elfutils: libelf and libdw
7 , bmfSupport ? true, eigen
8 , minimalBindings ? false
18 optionOnOff = option: if option then "on" else "off";
21 stdenv.mkDerivation rec {
25 src = fetchFromGitLab {
26 domain = "framagit.org";
30 sha256 = "sha256-EVTpW9jD1h8T2KRlDIqptKS6Wv1dVDfyJbXxrpsgmoo=";
33 propagatedBuildInputs = [ boost ];
34 nativeBuildInputs = [ cmake perl python3 ]
35 ++ optionals fortranSupport [ gfortran ]
36 ++ optionals buildJavaBindings [ openjdk ]
37 ++ optionals buildPythonBindings [ python3Packages.pybind11 ]
38 ++ optionals buildDocumentation [ fig2dev ghostscript doxygen ]
39 ++ optionals bmfSupport [ eigen ]
40 ++ optionals modelCheckingSupport [ libunwind libevent elfutils ];
43 ++ optionals buildPythonBindings [ "python" ];
45 # "Release" does not work. non-debug mode is Debug compiled with optimization
46 cmakeBuildType = "Debug";
48 "-Denable_documentation=${optionOnOff buildDocumentation}"
49 "-Denable_java=${optionOnOff buildJavaBindings}"
50 "-Denable_python=${optionOnOff buildPythonBindings}"
51 "-DSIMGRID_PYTHON_LIBDIR=./" # prevents CMake to install in ${python3} dir
52 "-Denable_msg=${optionOnOff buildJavaBindings}"
53 "-Denable_fortran=${optionOnOff fortranSupport}"
54 "-Denable_model-checking=${optionOnOff modelCheckingSupport}"
57 "-Denable_lib_in_jar=off"
58 "-Denable_maintainer_mode=off"
59 "-Denable_mallocators=on"
62 "-Dminimal-bindings=${optionOnOff minimalBindings}"
63 "-Denable_smpi_ISP_testsuite=${optionOnOff moreTests}"
64 "-Denable_smpi_MPICH3_testsuite=${optionOnOff moreTests}"
65 "-Denable_compile_warnings=off"
66 "-Denable_compile_optimizations=${optionOnOff optimize}"
67 "-Denable_lto=${optionOnOff optimize}"
69 # RPATH of binary /nix/store/.../bin/... contains a forbidden reference to /build/
70 "-DCMAKE_SKIP_BUILD_RPATH=ON"
72 makeFlags = optional debug "VERBOSE=1";
74 # needed to run tests and to ensure correct shabangs in output scripts
79 # needed by tests (so libsimgrid.so is found)
81 export LD_LIBRARY_PATH="$PWD/build/lib"
86 # prevent the execution of tests known to fail
87 cat <<EOW >CTestCustom.cmake
88 SET(CTEST_CUSTOM_TESTS_IGNORE smpi-replay-multiple)
91 # make sure tests are built in parallel (this can be long otherwise)
92 make tests -j $NIX_BUILD_CORES
95 postInstall = lib.optionalString withoutBin ''
96 # remove bin from output if requested.
97 # having a specific bin output would be cleaner but it does not work currently (circular references)
99 '' + lib.optionalString buildPythonBindings ''
100 # manually install the python binding if requested.
101 mkdir -p $python/lib/python${lib.versions.majorMinor python3.version}/site-packages/
102 cp ./lib/simgrid.cpython*.so $python/lib/python${lib.versions.majorMinor python3.version}/site-packages/
105 # improve debuggability if requested
106 hardeningDisable = lib.optionals debug [ "fortify" ];
110 description = "Framework for the simulation of distributed applications";
112 SimGrid is a toolkit that provides core functionalities for the
113 simulation of distributed applications in heterogeneous distributed
114 environments. The specific goal of the project is to facilitate
115 research in the area of distributed and parallel application
116 scheduling on distributed computing platforms ranging from simple
117 network of workstations to Computational Grids.
119 homepage = "https://simgrid.org/";
120 license = licenses.lgpl2Plus;
121 maintainers = with maintainers; [ mickours mpoquet ];
122 platforms = platforms.all;
123 broken = stdenv.isDarwin;