1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 fetchFromGitHub,
6 cmake,
7 setuptools,
8 libX11,
9 libXt,
10 libGL,
11 openimageio_2,
12 imath,
13 python,
14 apple-sdk_14,
15}:
16
17buildPythonPackage rec {
18 pname = "materialx";
19 version = "1.38.10";
20
21 # nixpkgs-update: no auto update
22 # Updates are disabled due to API breakage in 1.39+ that breaks almost all
23 # consumers.
24 src = fetchFromGitHub {
25 owner = "AcademySoftwareFoundation";
26 repo = "MaterialX";
27 rev = "v${version}";
28 hash = "sha256-/kMHmW2dptZNtjuhE5s+jvPRIdtY+FRiVtMU+tiBgQo=";
29 };
30
31 format = "other";
32
33 nativeBuildInputs = [
34 cmake
35 setuptools
36 ];
37
38 buildInputs =
39 [
40 openimageio_2
41 imath
42 ]
43 ++ lib.optionals stdenv.hostPlatform.isDarwin [
44 apple-sdk_14
45 ]
46 ++ lib.optionals (!stdenv.hostPlatform.isDarwin) [
47 libX11
48 libXt
49 libGL
50 ];
51
52 cmakeFlags = [
53 (lib.cmakeBool "MATERIALX_BUILD_OIIO" true)
54 (lib.cmakeBool "MATERIALX_BUILD_PYTHON" true)
55 (lib.cmakeBool "MATERIALX_BUILD_GEN_MSL" (
56 stdenv.hostPlatform.isLinux || stdenv.hostPlatform.isDarwin
57 ))
58 ];
59
60 pythonImportsCheck = [ "MaterialX" ];
61
62 postInstall = ''
63 # Make python lib properly accessible
64 target_dir=$out/${python.sitePackages}
65 mkdir -p $(dirname $target_dir)
66 # required for cmake to find the bindings, when included in other projects
67 ln -s $out/python $target_dir
68 '';
69
70 # Update to 1.39 has major API changes and downstream software
71 # needs to adapt, first. So, do not include in mass updates. For reference, see
72 # https://github.com/NixOS/nixpkgs/pull/326466#issuecomment-2293029160
73 # and https://github.com/NixOS/nixpkgs/issues/380230
74 passthru.skipBulkUpdate = true;
75
76 meta = {
77 changelog = "https://github.com/AcademySoftwareFoundation/MaterialX/blob/${src.rev}/CHANGELOG.md";
78 description = "Open standard for representing rich material and look-development content in computer graphics";
79 homepage = "https://materialx.org";
80 maintainers = [ lib.maintainers.gador ];
81 platforms = lib.platforms.unix;
82 license = lib.licenses.mpl20;
83 };
84}