1{ lib, config, stdenv, fetchFromGitHub, symlinkJoin, wrapGAppsHook, cmake, boost172
2, pkg-config, flex, bison, libpng, libtiff, zlib, python3, embree, openexr
3, openimagedenoise, openimageio, tbb, c-blosc, gtk3, pcre, doxygen
4# OpenCL Support
5, withOpenCL ? true, ocl-icd
6# Cuda Support
7, withCuda ? config.cudaSupport or false, cudatoolkit }:
8
9let
10 boostWithPython = boost172.override {
11 enablePython = true;
12 enableNumpy = true;
13 python = python3;
14 };
15
16 # Requires a version number like "<MAJOR><MINOR>"
17 pythonVersion = (lib.versions.major python3.version)
18 + (lib.versions.minor python3.version);
19
20in stdenv.mkDerivation rec {
21 pname = "luxcorerender";
22 version = "2.4";
23
24 src = fetchFromGitHub {
25 owner = "LuxCoreRender";
26 repo = "LuxCore";
27 rev = "luxcorerender_v${version}";
28 sha256 = "0xvivw79719fa1q762b76nyvzawfd3hmp8y5j04bax8a7f8mfa9k";
29 };
30
31 nativeBuildInputs = [ pkg-config cmake flex bison doxygen wrapGAppsHook ];
32
33 buildInputs = [
34 libpng
35 libtiff
36 zlib
37 boostWithPython.dev
38 python3
39 embree
40 openexr
41 openimagedenoise
42 tbb
43 c-blosc
44 gtk3
45 pcre
46 openimageio.dev
47 openimageio.out
48 ] ++ lib.optionals withOpenCL [ ocl-icd ]
49 ++ lib.optionals withCuda [ cudatoolkit ];
50
51 cmakeFlags = [ "-DPYTHON_V=${pythonVersion}" ]
52 ++ lib.optional (!withOpenCL) "-DLUXRAYS_DISABLE_OPENCL=1"
53 ++ lib.optional (!withCuda) "-DLUXRAYS_DISABLE_CUDA=1";
54
55 preConfigure = ''
56 NIX_LDFLAGS+=" -lpython3"
57 '';
58
59 installPhase = ''
60 mkdir -p $out/bin
61 mkdir -p $out/lib
62 cp -va bin/* $out/bin
63 cp -va lib/* $out/lib
64 '';
65
66 meta = with lib; {
67 description = "Open source, physically based, unbiased rendering engine";
68 homepage = "https://luxcorerender.org/";
69 maintainers = with maintainers; [ hodapp ];
70 license = licenses.asl20;
71 platforms = platforms.linux;
72 };
73}
74
75# TODO (might not be necessary):
76#
77# luxcoreui still gives warnings like: "failed to commit changes to
78# dconf: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The
79# name ca.desrt.dconf was not provided by any .service files"
80
81# CMake complains of the FindOpenGL/GLVND preference