Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ 2 alembic, 3 bison, 4 boost, 5 buildPythonPackage, 6 cmake, 7 darwin, 8 doxygen, 9 draco, 10 embree, 11 fetchFromGitHub, 12 fetchpatch, 13 flex, 14 git, 15 graphviz-nox, 16 imath, 17 jinja2, 18 lib, 19 libGL, 20 libX11, 21 libXt, 22 materialx, 23 ninja, 24 numpy, 25 opencolorio, 26 openimageio, 27 opensubdiv, 28 osl, 29 ptex, 30 pyopengl, 31 pyqt6, 32 pyside6, 33 python, 34 qt6, 35 setuptools, 36 tbb, 37 withDocs ? false, 38 withOsl ? true, 39 withTools ? false, 40 withUsdView ? false, 41 writeShellScriptBin, 42}: 43 44let 45 # Matches the pyside6-uic implementation 46 # https://code.qt.io/cgit/pyside/pyside-setup.git/tree/sources/pyside-tools/pyside_tool.py?id=e501cad66146a49c7a259579c7bb94bc93a67a08#n82 47 pyside-tools-uic = writeShellScriptBin "pyside6-uic" '' 48 exec ${qt6.qtbase}/libexec/uic -g python "$@" 49 ''; 50in 51 52buildPythonPackage rec { 53 pname = "openusd"; 54 version = "24.05"; 55 56 src = fetchFromGitHub { 57 owner = "PixarAnimationStudios"; 58 repo = "OpenUSD"; 59 rev = "refs/tags/v${version}"; 60 hash = "sha256-akwLIB5YUbnDiaQXX/K5YLXzWlTYWZG51dtxbSFxPt0="; 61 }; 62 63 stdenv = if python.stdenv.isDarwin then darwin.apple_sdk_11_0.stdenv else python.stdenv; 64 65 outputs = [ "out" ] ++ lib.optional withDocs "doc"; 66 67 format = "other"; 68 69 patches = [ 70 (fetchpatch { 71 name = "port-to-embree-4.patch"; 72 url = "https://github.com/PixarAnimationStudios/OpenUSD/pull/2266/commits/4b6c23d459c602fdac5e0ebc9b7722cbd5475e86.patch"; 73 hash = "sha256-yjqdGAVqfEsOX1W/tG6c+GgQLYya5U9xgUe/sNIuDbw="; 74 }) 75 ]; 76 77 cmakeFlags = [ 78 "-DPXR_BUILD_ALEMBIC_PLUGIN=ON" 79 "-DPXR_BUILD_DRACO_PLUGIN=ON" 80 "-DPXR_BUILD_EMBREE_PLUGIN=ON" 81 "-DPXR_BUILD_EXAMPLES=OFF" 82 "-DPXR_BUILD_IMAGING=ON" 83 "-DPXR_BUILD_MONOLITHIC=ON" # Seems to be commonly linked to monolithically 84 "-DPXR_BUILD_TESTS=OFF" 85 "-DPXR_BUILD_TUTORIALS=OFF" 86 "-DPXR_BUILD_USD_IMAGING=ON" 87 (lib.cmakeBool "PXR_BUILD_DOCUMENTATION" withDocs) 88 (lib.cmakeBool "PXR_BUILD_PYTHON_DOCUMENTATION" withDocs) 89 (lib.cmakeBool "PXR_BUILD_USDVIEW" withUsdView) 90 (lib.cmakeBool "PXR_BUILD_USD_TOOLS" withTools) 91 (lib.cmakeBool "PXR_ENABLE_MATERIALX_SUPPORT" true) 92 (lib.cmakeBool "PXR_ENABLE_OSL_SUPPORT" (!stdenv.isDarwin && withOsl)) 93 ]; 94 95 nativeBuildInputs = 96 [ 97 cmake 98 ninja 99 setuptools 100 ] 101 ++ lib.optionals withDocs [ 102 git 103 graphviz-nox 104 doxygen 105 ] 106 ++ lib.optionals withUsdView [ qt6.wrapQtAppsHook ]; 107 108 buildInputs = 109 [ 110 alembic.dev 111 bison 112 boost 113 draco 114 embree 115 flex 116 imath 117 materialx 118 opencolorio 119 openimageio 120 opensubdiv 121 ptex 122 tbb 123 ] 124 ++ lib.optionals stdenv.isLinux [ 125 libGL 126 libX11 127 libXt 128 ] 129 ++ lib.optionals stdenv.isDarwin (with darwin.apple_sdk_11_0.frameworks; [ Cocoa ]) 130 ++ lib.optionals withOsl [ osl ] 131 ++ lib.optionals withUsdView [ qt6.qtbase ] 132 ++ lib.optionals (withUsdView && stdenv.isLinux) [ 133 qt6.qtbase 134 qt6.qtwayland 135 ]; 136 137 propagatedBuildInputs = 138 [ 139 boost 140 jinja2 141 numpy 142 pyopengl 143 ] 144 ++ lib.optionals (withTools || withUsdView) [ 145 pyside-tools-uic 146 pyside6 147 ] 148 ++ lib.optionals withUsdView [ pyqt6 ]; 149 150 pythonImportsCheck = [ 151 "pxr" 152 "pxr.Usd" 153 ]; 154 155 postInstall = 156 '' 157 # Make python lib properly accessible 158 target_dir=$out/${python.sitePackages} 159 mkdir -p $(dirname $target_dir) 160 mv $out/lib/python $target_dir 161 '' 162 + lib.optionalString withDocs '' 163 mv $out/docs $doc 164 ''; 165 166 meta = { 167 description = "Universal Scene Description"; 168 longDescription = '' 169 Universal Scene Description (USD) is an efficient, scalable system 170 for authoring, reading, and streaming time-sampled scene description 171 for interchange between graphics applications. 172 ''; 173 homepage = "https://openusd.org/"; 174 license = lib.licenses.asl20; 175 maintainers = with lib.maintainers; [ shaddydc ]; 176 }; 177}