24 # for binding generation
28 # can take a long time, generates > 30000 images/graphs
29 enableDoxygen ? false,
36 # for manual, tetex is used to get the eps2pdf binary
37 # texlive to get latexmk. building manual still fails though
43 # generates python bindings
51 pythonEnv = python.withPackages (
53 lib.optional withManual ps.sphinx
54 ++ lib.optionals pythonSupport (
64 stdenv.mkDerivation rec {
68 src = fetchFromGitLab {
71 rev = "ns-3.${version}";
72 hash = "sha256-2d8xCCfxRpcCZgt7ne17F7cUo/wIxLyvjQs3izNUnmY=";
83 # ncurses is a hidden dependency of waf when checking python
85 lib.optionals pythonSupport [
89 ++ lib.optionals enableDoxygen [
94 ++ lib.optionals withManual [
107 root # provides cppyy
117 propagatedBuildInputs = [ pythonEnv ];
120 substituteInPlace src/tap-bridge/CMakeLists.txt \
121 --replace '-DTAP_CREATOR="''${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/src/tap-bridge/' "-DTAP_CREATOR=\"$out/libexec/ns3/"
123 substituteInPlace src/fd-net-device/CMakeLists.txt \
124 --replace '-DRAW_SOCK_CREATOR="''${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/src/fd-net-device/' "-DRAW_SOCK_CREATOR=\"$out/libexec/ns3/"
126 substituteInPlace src/fd-net-device/CMakeLists.txt \
127 --replace '-DTAP_DEV_CREATOR="''${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/src/fd-net-device/' "-DTAP_DEV_CREATOR=\"$out/libexec/ns3/"
133 "build" + lib.optionalString enableDoxygen " doxygen" + lib.optionalString withManual "sphinx";
135 # to prevent fatal error: 'backward_warning.h' file not found
136 CXXFLAGS = "-D_GLIBCXX_PERMIT_BACKWARD_HASH";
138 # Make generated python bindings discoverable in customized python environment
140 pythonModule = python;
144 "-DPython3_LIBRARY_DIRS=${pythonEnv}/lib"
145 "-DPython3_INCLUDE_DIRS=${pythonEnv}/include"
146 "-DPython3_EXECUTABLE=${pythonEnv}/bin/python"
147 "-DNS3_PYTHON_BINDINGS=ON"
148 "-DNS3_DES_METRICS=ON"
149 "-DNS3_BINDINGS_INSTALL_DIR=${pythonEnv.sitePackages}"
153 "-DGTK3_GLIBCONFIG_INCLUDE_DIR=${glib.out}/lib/glib-2.0/include"
154 ] ++ lib.optional doCheck "-DNS3_TESTS=ON";
156 # strictoverflow prevents clang from discovering pyembed when bindings
163 homepage = "http://www.nsnam.org";
164 license = licenses.gpl3;
165 description = "Discrete time event network simulator";
166 platforms = with platforms; unix;
167 maintainers = with maintainers; [
171 # never built on aarch64-darwin since first introduction in nixpkgs
173 (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64)
174 || (stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isAarch64);