nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 137 lines 2.9 kB view raw
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 tag = "v${version}"; 68 sha256 = "1ik6j1lw5nldj4i3lllrywqg54m9i2vxkxsb2zr4q0d2rfywhn23"; 69 fetchSubmodules = true; 70 }; 71 72 postPatch = '' 73 substituteInPlace lib/nitro/CMakeLists.txt \ 74 --replace-fail 'cmake_minimum_required(VERSION 3.2)' 'cmake_minimum_required(VERSION 3.10)' 75 substituteInPlace lib/json/CMakeLists.txt \ 76 --replace-fail 'cmake_minimum_required(VERSION 3.1)' 'cmake_minimum_required(VERSION 3.10)' 77 ''; 78 79 nativeBuildInputs = [ 80 cmake 81 git 82 pkg-config 83 ] 84 ++ lib.optionals withCuda [ 85 addDriverRunpath 86 ]; 87 88 buildInputs = [ 89 hwloc 90 ] 91 ++ ( 92 if withCuda then 93 [ 94 glibc_multi 95 cudatoolkit 96 ] 97 else 98 [ glibc.static ] 99 ); 100 101 NIX_LDFLAGS = lib.optionals withCuda [ 102 "-L${cudatoolkit}/lib/stubs" 103 ]; 104 105 cmakeFlags = [ 106 "-DFIRESTARTER_BUILD_HWLOC=OFF" 107 "-DCMAKE_C_COMPILER_WORKS=1" 108 "-DCMAKE_CXX_COMPILER_WORKS=1" 109 ] 110 ++ lib.optionals withCuda [ 111 "-DFIRESTARTER_BUILD_TYPE=FIRESTARTER_CUDA" 112 ]; 113 114 installPhase = '' 115 runHook preInstall 116 mkdir -p $out/bin 117 cp src/FIRESTARTER${lib.optionalString withCuda "_CUDA"} $out/bin/ 118 runHook postInstall 119 ''; 120 121 postFixup = lib.optionalString withCuda '' 122 addDriverRunpath $out/bin/FIRESTARTER_CUDA 123 ''; 124 125 meta = { 126 broken = (stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isAarch64); 127 homepage = "https://tu-dresden.de/zih/forschung/projekte/firestarter"; 128 description = "Processor Stress Test Utility"; 129 platforms = lib.platforms.linux; 130 maintainers = with lib.maintainers; [ 131 astro 132 marenz 133 ]; 134 license = lib.licenses.gpl3; 135 mainProgram = "FIRESTARTER"; 136 }; 137}