nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 179 lines 5.1 kB view raw
1{ 2 backendStdenv, 3 boost178, 4 buildRedist, 5 cudaAtLeast, 6 e2fsprogs, 7 gst_all_1, 8 lib, 9 nss, 10 numactl, 11 pulseaudio, 12 qt5 ? null, 13 qt6 ? null, 14 rdma-core, 15 ucx, 16 wayland, 17 libxtst, 18 libxrandr, 19 libxdamage, 20 libxcursor, 21}: 22let 23 # NOTE(@connorbaker): nsight_systems doesn't support Jetson, so no need for case splitting on aarch64-linux. 24 hostDir = 25 { 26 aarch64-linux = "host-linux-armv8"; 27 x86_64-linux = "host-linux-x64"; 28 } 29 .${backendStdenv.hostPlatform.system} 30 or (throw "Unsupported system: ${backendStdenv.hostPlatform.system}"); 31 targetDir = 32 { 33 aarch64-linux = "target-linux-sbsa-armv8"; 34 x86_64-linux = "target-linux-x64"; 35 } 36 .${backendStdenv.hostPlatform.system} 37 or (throw "Unsupported system: ${backendStdenv.hostPlatform.system}"); 38in 39buildRedist ( 40 finalAttrs: 41 let 42 qt = if lib.strings.versionOlder finalAttrs.version "2022.4.2.1" then qt5 else qt6; 43 qtwayland = 44 if lib.versions.major qt.qtbase.version == "5" then 45 lib.getBin qt.qtwayland 46 else 47 lib.getLib qt.qtwayland; 48 qtWaylandPlugins = "${qtwayland}/${qt.qtbase.qtPluginPrefix}"; 49 inherit (qt) wrapQtAppsHook qtwebengine; 50 in 51 { 52 redistName = "cuda"; 53 pname = "nsight_systems"; 54 55 allowFHSReferences = true; 56 57 outputs = [ "out" ]; 58 59 # An ad hoc replacement for 60 # https://github.com/ConnorBaker/cuda-redist-find-features/issues/11 61 env.rmPatterns = toString [ 62 "${hostDir}/lib{arrow,jpeg}*" 63 "${hostDir}/lib{ssl,ssh,crypto}*" 64 "${hostDir}/libboost*" 65 "${hostDir}/libexec" 66 "${hostDir}/libstdc*" 67 "${hostDir}/python/bin/python" 68 "${hostDir}/Mesa" 69 ]; 70 71 # NOTE(@connorbaker): nsight-exporter and nsight-sys are deprecated scripts wrapping nsys, it's fine to remove them. 72 prePatch = '' 73 if [[ -d bin ]]; then 74 nixLog "Removing bin wrapper scripts" 75 for knownWrapper in bin/{nsys{,-ui},nsight-{exporter,sys}}; do 76 [[ -e $knownWrapper ]] && rm -v "$knownWrapper" 77 done 78 unset -v knownWrapper 79 80 nixLog "Removing empty bin directory" 81 rmdir -v bin 82 fi 83 84 if [[ -d nsight-systems ]]; then 85 nixLog "Lifting components of Nsight System to the top level" 86 mv -v nsight-systems/*/* . 87 nixLog "Removing empty nsight-systems directory" 88 rmdir -pv nsight-systems/* 89 fi 90 ''; 91 92 postPatch = '' 93 for path in $rmPatterns; do 94 rm -r "$path" 95 done 96 patchShebangs . 97 ''; 98 99 nativeBuildInputs = [ wrapQtAppsHook ]; 100 101 dontWrapQtApps = true; 102 103 # TODO(@connorbaker): Fix dependencies for earlier (CUDA <12.6) versions of nsight_systems. 104 buildInputs = [ 105 qt6.qtdeclarative 106 qt6.qtsvg 107 qt6.qtimageformats 108 qt6.qtpositioning 109 qt6.qtscxml 110 qt6.qttools 111 qtwebengine 112 qt6.qtwayland 113 boost178 114 e2fsprogs 115 gst_all_1.gst-plugins-base 116 gst_all_1.gstreamer 117 nss 118 numactl 119 pulseaudio 120 qt6.qtbase 121 qtWaylandPlugins 122 rdma-core 123 ucx 124 wayland 125 libxcursor 126 libxdamage 127 libxrandr 128 libxtst 129 ] 130 # NOTE(@connorbaker): Seems to be required only for aarch64-linux. 131 ++ lib.optionals (backendStdenv.hostPlatform.isAarch64 && cudaAtLeast "11.8") [ 132 gst_all_1.gst-plugins-bad 133 ]; 134 135 postInstall = '' 136 moveToOutput '${hostDir}' "''${!outputBin}" 137 moveToOutput '${targetDir}' "''${!outputBin}" 138 moveToOutput 'bin' "''${!outputBin}" 139 wrapQtApp "''${!outputBin}/${hostDir}/nsys-ui.bin" 140 ''; 141 142 # lib needs libtiff.so.5, but nixpkgs provides libtiff.so.6 143 preFixup = '' 144 patchelf --replace-needed libtiff.so.5 libtiff.so "''${!outputBin}/${hostDir}/Plugins/imageformats/libqtiff.so" 145 ''; 146 147 autoPatchelfIgnoreMissingDeps = [ 148 "libcuda.so.1" 149 "libnvidia-ml.so.1" 150 ]; 151 152 brokenAssertions = [ 153 { 154 # Boost 1.70 has been deprecated in Nixpkgs; releases older than the one for CUDA 11.8 are not supported. 155 message = "Boost 1.70 is required and available"; 156 assertion = lib.versionAtLeast finalAttrs.version "2022.4.2.1"; 157 } 158 { 159 message = "Qt 5 is required and available"; 160 assertion = lib.versionOlder finalAttrs.version "2022.4.2.1" -> qt5 != null; 161 } 162 { 163 message = "Qt 6 is required and available"; 164 assertion = lib.versionAtLeast finalAttrs.version "2022.4.2.1" -> qt6 != null; 165 } 166 ]; 167 168 meta = { 169 description = "System-wide performance analysis and visualization tool"; 170 longDescription = '' 171 NVIDIA Nsight Systems is a system-wide performance analysis tool designed to visualize an application's 172 algorithms, identify the largest opportunities to optimize, and tune to scale efficiently across any quantity or 173 size of CPUs and GPUs, from large servers to our smallest systems-on-a-chip (SoCs). 174 ''; 175 homepage = "https://developer.nvidia.com/nsight-systems"; 176 changelog = "https://docs.nvidia.com/nsight-systems/ReleaseNotes"; 177 }; 178 } 179)