Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ 2 stdenv, 3 lib, 4 fetchFromGitHub, 5 fetchzip, 6 addDriverRunpath, 7 cmake, 8 glibc_multi, 9 glibc, 10 git, 11 pkg-config, 12 cudaPackages ? { }, 13 withCuda ? false, 14}: 15 16let 17 inherit (cudaPackages) cudatoolkit; 18 19 hwloc = stdenv.mkDerivation rec { 20 pname = "hwloc"; 21 version = "2.2.0"; 22 23 src = fetchzip { 24 url = "https://download.open-mpi.org/release/hwloc/v${lib.versions.majorMinor version}/hwloc-${version}.tar.gz"; 25 sha256 = "1ibw14h9ppg8z3mmkwys8vp699n85kymdz20smjd2iq9b67y80b6"; 26 }; 27 28 configureFlags = [ 29 "--enable-static" 30 "--disable-libudev" 31 "--disable-shared" 32 "--disable-doxygen" 33 "--disable-libxml2" 34 "--disable-cairo" 35 "--disable-io" 36 "--disable-pci" 37 "--disable-opencl" 38 "--disable-cuda" 39 "--disable-nvml" 40 "--disable-gl" 41 "--disable-libudev" 42 "--disable-plugin-dlopen" 43 "--disable-plugin-ltdl" 44 ]; 45 46 nativeBuildInputs = [ pkg-config ]; 47 48 enableParallelBuilding = true; 49 50 outputs = [ 51 "out" 52 "lib" 53 "dev" 54 "doc" 55 "man" 56 ]; 57 }; 58 59in 60stdenv.mkDerivation rec { 61 pname = "firestarter"; 62 version = "2.0"; 63 64 src = fetchFromGitHub { 65 owner = "tud-zih-energy"; 66 repo = "FIRESTARTER"; 67 rev = "v${version}"; 68 sha256 = "1ik6j1lw5nldj4i3lllrywqg54m9i2vxkxsb2zr4q0d2rfywhn23"; 69 fetchSubmodules = true; 70 }; 71 72 nativeBuildInputs = [ 73 cmake 74 git 75 pkg-config 76 ] 77 ++ lib.optionals withCuda [ 78 addDriverRunpath 79 ]; 80 81 buildInputs = [ 82 hwloc 83 ] 84 ++ ( 85 if withCuda then 86 [ 87 glibc_multi 88 cudatoolkit 89 ] 90 else 91 [ glibc.static ] 92 ); 93 94 NIX_LDFLAGS = lib.optionals withCuda [ 95 "-L${cudatoolkit}/lib/stubs" 96 ]; 97 98 cmakeFlags = [ 99 "-DFIRESTARTER_BUILD_HWLOC=OFF" 100 "-DCMAKE_C_COMPILER_WORKS=1" 101 "-DCMAKE_CXX_COMPILER_WORKS=1" 102 ] 103 ++ lib.optionals withCuda [ 104 "-DFIRESTARTER_BUILD_TYPE=FIRESTARTER_CUDA" 105 ]; 106 107 installPhase = '' 108 runHook preInstall 109 mkdir -p $out/bin 110 cp src/FIRESTARTER${lib.optionalString withCuda "_CUDA"} $out/bin/ 111 runHook postInstall 112 ''; 113 114 postFixup = lib.optionalString withCuda '' 115 addDriverRunpath $out/bin/FIRESTARTER_CUDA 116 ''; 117 118 meta = with lib; { 119 broken = (stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isAarch64); 120 homepage = "https://tu-dresden.de/zih/forschung/projekte/firestarter"; 121 description = "Processor Stress Test Utility"; 122 platforms = platforms.linux; 123 maintainers = with maintainers; [ 124 astro 125 marenz 126 ]; 127 license = licenses.gpl3; 128 mainProgram = "FIRESTARTER"; 129 }; 130}