Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ 2 stdenv, 3 lib, 4 fetchFromGitHub, 5 cmake, 6 pkg-config, 7 ispc, 8 tbb, 9 glfw, 10 openimageio, 11 libjpeg, 12 libpng, 13 libpthreadstubs, 14 libX11, 15 glib, 16}: 17 18stdenv.mkDerivation (finalAttrs: { 19 pname = "embree"; 20 version = "4.4.0"; 21 22 src = fetchFromGitHub { 23 owner = "embree"; 24 repo = "embree"; 25 tag = "v${finalAttrs.version}"; 26 hash = "sha256-bHVokEfnTW2cJqx3Zz2x1hIH07WamPAVFY9tiv6nHd0="; 27 }; 28 29 postPatch = '' 30 # Fix duplicate /nix/store/.../nix/store/.../ paths 31 sed -i "s|SET(EMBREE_ROOT_DIR .*)|set(EMBREE_ROOT_DIR $out)|" \ 32 common/cmake/embree-config.cmake 33 sed -i "s|$""{EMBREE_ROOT_DIR}/||" common/cmake/embree-config.cmake 34 substituteInPlace common/math/emath.h --replace 'defined(__MACOSX__) && !defined(__INTEL_COMPILER)' 0 35 substituteInPlace common/math/emath.h --replace 'defined(__WIN32__) || defined(__FreeBSD__)' 'defined(__WIN32__) || defined(__FreeBSD__) || defined(__MACOSX__)' 36 ''; 37 38 cmakeFlags = [ 39 "-DEMBREE_TUTORIALS=OFF" 40 "-DEMBREE_RAY_MASK=ON" 41 "-DTBB_ROOT=${tbb}" 42 "-DTBB_INCLUDE_DIR=${tbb.dev}/include" 43 ]; 44 45 nativeBuildInputs = [ 46 ispc 47 pkg-config 48 cmake 49 ]; 50 buildInputs = [ 51 tbb 52 glfw 53 openimageio 54 libjpeg 55 libpng 56 libX11 57 libpthreadstubs 58 ] 59 ++ lib.optionals stdenv.hostPlatform.isDarwin [ glib ]; 60 61 meta = { 62 description = "High performance ray tracing kernels from Intel"; 63 homepage = "https://embree.github.io/"; 64 maintainers = with lib.maintainers; [ 65 hodapp 66 ]; 67 license = lib.licenses.asl20; 68 platforms = lib.platforms.unix; 69 }; 70})