nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 fetchFromGitHub,
6 cmake,
7 setuptools,
8 libX11,
9 libXt,
10 libGL,
11 openimageio,
12 imath,
13 python,
14}:
15
16buildPythonPackage rec {
17 pname = "materialx";
18 version = "1.39.4";
19
20 src = fetchFromGitHub {
21 owner = "AcademySoftwareFoundation";
22 repo = "MaterialX";
23 rev = "v${version}";
24 hash = "sha256-XNfXOC76zM5Ns2DyyE3mKCJ1iJaszs1M0rBdVLRDo8E=";
25 };
26
27 pyproject = false;
28
29 nativeBuildInputs = [
30 cmake
31 setuptools
32 ];
33
34 buildInputs = [
35 openimageio
36 imath
37 ]
38 ++ lib.optionals (!stdenv.hostPlatform.isDarwin) [
39 libX11
40 libXt
41 libGL
42 ];
43
44 cmakeFlags = [
45 "-DCMAKE_POLICY_VERSION_MINIMUM=3.5"
46 (lib.cmakeBool "MATERIALX_BUILD_OIIO" true)
47 (lib.cmakeBool "MATERIALX_BUILD_SHARED_LIBS" true)
48 (lib.cmakeBool "MATERIALX_BUILD_PYTHON" true)
49 (lib.cmakeBool "MATERIALX_BUILD_GEN_MSL" (
50 stdenv.hostPlatform.isLinux || stdenv.hostPlatform.isDarwin
51 ))
52 ];
53
54 pythonImportsCheck = [ "MaterialX" ];
55
56 postInstall = ''
57 # Make python lib properly accessible
58 target_dir=$out/${python.sitePackages}
59 mkdir -p $(dirname $target_dir)
60 # required for cmake to find the bindings, when included in other projects
61 ln -s $out/python $target_dir
62 '';
63
64 meta = {
65 changelog = "https://github.com/AcademySoftwareFoundation/MaterialX/blob/${src.rev}/CHANGELOG.md";
66 description = "Open standard for representing rich material and look-development content in computer graphics";
67 homepage = "https://materialx.org";
68 maintainers = [ lib.maintainers.gador ];
69 platforms = lib.platforms.unix;
70 license = lib.licenses.mpl20;
71 };
72}