Loading pkgs/development/cuda-modules/_cuda/fixups/nsight_systems.nix +77 −50 Original line number Diff line number Diff line { boost178, cuda_cudart, cudaAtLeast, e2fsprogs, gst_all_1, lib, Loading @@ -16,9 +17,9 @@ }: prevAttrs: let inherit (prevAttrs) version; qtwayland = lib.getLib qt6.qtwayland; qtWaylandPlugins = "${qtwayland}/${qt6.qtbase.qtPluginPrefix}"; # NOTE(@connorbaker): nsight_systems doesn't support Jetson, so no need for case splitting on aarch64-linux. hostDir = { aarch64-linux = "host-linux-armv8"; Loading @@ -31,33 +32,61 @@ let x86_64-linux = "target-linux-x64"; } .${stdenv.hostPlatform.system} or (throw "Unsupported system: ${stdenv.hostPlatform.system}"); versionString = with lib.versions; "${majorMinor version}.${patch version}"; in { outputs = [ "out" ]; # NOTE(@connorbaker): Force a single output so relative lookups work. # An ad hoc replacement for # https://github.com/ConnorBaker/cuda-redist-find-features/issues/11 env = prevAttrs.env or { } // { rmPatterns = prevAttrs.env.rmPatterns or "" + toString [ "nsight-systems/${versionString}/${hostDir}/lib{arrow,jpeg}*" "nsight-systems/${versionString}/${hostDir}/lib{ssl,ssh,crypto}*" "nsight-systems/${versionString}/${hostDir}/libboost*" "nsight-systems/${versionString}/${hostDir}/libexec" "nsight-systems/${versionString}/${hostDir}/libstdc*" "nsight-systems/${versionString}/${hostDir}/python/bin/python" "nsight-systems/${versionString}/${hostDir}/Mesa" "${hostDir}/lib{arrow,jpeg}*" "${hostDir}/lib{ssl,ssh,crypto}*" "${hostDir}/libboost*" "${hostDir}/libexec" "${hostDir}/libstdc*" "${hostDir}/python/bin/python" "${hostDir}/Mesa" ]; }; # NOTE(@connorbaker): nsight-exporter and nsight-sys are deprecated scripts wrapping nsys, it's fine to remove them. prePatch = prevAttrs.prePatch or "" + '' if [[ -d bin ]]; then nixLog "Removing bin wrapper scripts" for knownWrapper in bin/{nsys{,-ui},nsight-{exporter,sys}}; do [[ -e $knownWrapper ]] && rm -v "$knownWrapper" done unset -v knownWrapper nixLog "Removing empty bin directory" rmdir -v bin fi if [[ -d nsight-systems ]]; then nixLog "Lifting components of Nsight System to the top level" mv -v nsight-systems/*/* . nixLog "Removing empty nsight-systems directory" rmdir -pv nsight-systems/* fi ''; postPatch = prevAttrs.postPatch or "" + '' for path in $rmPatterns; do rm -r "$path" done patchShebangs nsight-systems ''; nativeBuildInputs = prevAttrs.nativeBuildInputs or [ ] ++ [ qt6.wrapQtAppsHook ]; dontWrapQtApps = true; buildInputs = prevAttrs.buildInputs or [ ] ++ [ buildInputs = prevAttrs.buildInputs or [ ] ++ [ (qt6.qtdeclarative or qt6.full) (qt6.qtsvg or qt6.full) (qt6.qtimageformats or qt6.full) Loading @@ -83,24 +112,22 @@ in xorg.libXdamage xorg.libXrandr xorg.libXtst ] # NOTE(@connorbaker): Seems to be required only for aarch64-linux. ++ lib.optionals (stdenv.hostPlatform.isAarch64 && cudaAtLeast "11.8") [ gst_all_1.gst-plugins-bad ]; postInstall = prevAttrs.postInstall or "" # 1. Move dependencies of nsys, nsys-ui binaries to bin output # 2. Fix paths in wrapper scripts + '' moveToOutput 'nsight-systems/${versionString}/${hostDir}' "''${!outputBin}" moveToOutput 'nsight-systems/${versionString}/${targetDir}' "''${!outputBin}" moveToOutput 'nsight-systems/${versionString}/bin' "''${!outputBin}" substituteInPlace $bin/bin/nsys $bin/bin/nsys-ui \ --replace-fail 'nsight-systems-#VERSION_RSPLIT#' nsight-systems/${versionString} wrapQtApp "$bin/nsight-systems/${versionString}/${hostDir}/nsys-ui.bin" postInstall = prevAttrs.postInstall or "" + '' moveToOutput '${hostDir}' "''${!outputBin}" moveToOutput '${targetDir}' "''${!outputBin}" moveToOutput 'bin' "''${!outputBin}" wrapQtApp "''${!outputBin}/${hostDir}/nsys-ui.bin" ''; preFixup = prevAttrs.preFixup or "" + '' # lib needs libtiff.so.5, but nixpkgs provides libtiff.so.6 patchelf --replace-needed libtiff.so.5 libtiff.so $bin/nsight-systems/${versionString}/${hostDir}/Plugins/imageformats/libqtiff.so preFixup = prevAttrs.preFixup or "" + '' patchelf --replace-needed libtiff.so.5 libtiff.so "''${!outputBin}/${hostDir}/Plugins/imageformats/libqtiff.so" ''; autoPatchelfIgnoreMissingDeps = prevAttrs.autoPatchelfIgnoreMissingDeps or [ ] ++ [ Loading Loading
pkgs/development/cuda-modules/_cuda/fixups/nsight_systems.nix +77 −50 Original line number Diff line number Diff line { boost178, cuda_cudart, cudaAtLeast, e2fsprogs, gst_all_1, lib, Loading @@ -16,9 +17,9 @@ }: prevAttrs: let inherit (prevAttrs) version; qtwayland = lib.getLib qt6.qtwayland; qtWaylandPlugins = "${qtwayland}/${qt6.qtbase.qtPluginPrefix}"; # NOTE(@connorbaker): nsight_systems doesn't support Jetson, so no need for case splitting on aarch64-linux. hostDir = { aarch64-linux = "host-linux-armv8"; Loading @@ -31,33 +32,61 @@ let x86_64-linux = "target-linux-x64"; } .${stdenv.hostPlatform.system} or (throw "Unsupported system: ${stdenv.hostPlatform.system}"); versionString = with lib.versions; "${majorMinor version}.${patch version}"; in { outputs = [ "out" ]; # NOTE(@connorbaker): Force a single output so relative lookups work. # An ad hoc replacement for # https://github.com/ConnorBaker/cuda-redist-find-features/issues/11 env = prevAttrs.env or { } // { rmPatterns = prevAttrs.env.rmPatterns or "" + toString [ "nsight-systems/${versionString}/${hostDir}/lib{arrow,jpeg}*" "nsight-systems/${versionString}/${hostDir}/lib{ssl,ssh,crypto}*" "nsight-systems/${versionString}/${hostDir}/libboost*" "nsight-systems/${versionString}/${hostDir}/libexec" "nsight-systems/${versionString}/${hostDir}/libstdc*" "nsight-systems/${versionString}/${hostDir}/python/bin/python" "nsight-systems/${versionString}/${hostDir}/Mesa" "${hostDir}/lib{arrow,jpeg}*" "${hostDir}/lib{ssl,ssh,crypto}*" "${hostDir}/libboost*" "${hostDir}/libexec" "${hostDir}/libstdc*" "${hostDir}/python/bin/python" "${hostDir}/Mesa" ]; }; # NOTE(@connorbaker): nsight-exporter and nsight-sys are deprecated scripts wrapping nsys, it's fine to remove them. prePatch = prevAttrs.prePatch or "" + '' if [[ -d bin ]]; then nixLog "Removing bin wrapper scripts" for knownWrapper in bin/{nsys{,-ui},nsight-{exporter,sys}}; do [[ -e $knownWrapper ]] && rm -v "$knownWrapper" done unset -v knownWrapper nixLog "Removing empty bin directory" rmdir -v bin fi if [[ -d nsight-systems ]]; then nixLog "Lifting components of Nsight System to the top level" mv -v nsight-systems/*/* . nixLog "Removing empty nsight-systems directory" rmdir -pv nsight-systems/* fi ''; postPatch = prevAttrs.postPatch or "" + '' for path in $rmPatterns; do rm -r "$path" done patchShebangs nsight-systems ''; nativeBuildInputs = prevAttrs.nativeBuildInputs or [ ] ++ [ qt6.wrapQtAppsHook ]; dontWrapQtApps = true; buildInputs = prevAttrs.buildInputs or [ ] ++ [ buildInputs = prevAttrs.buildInputs or [ ] ++ [ (qt6.qtdeclarative or qt6.full) (qt6.qtsvg or qt6.full) (qt6.qtimageformats or qt6.full) Loading @@ -83,24 +112,22 @@ in xorg.libXdamage xorg.libXrandr xorg.libXtst ] # NOTE(@connorbaker): Seems to be required only for aarch64-linux. ++ lib.optionals (stdenv.hostPlatform.isAarch64 && cudaAtLeast "11.8") [ gst_all_1.gst-plugins-bad ]; postInstall = prevAttrs.postInstall or "" # 1. Move dependencies of nsys, nsys-ui binaries to bin output # 2. Fix paths in wrapper scripts + '' moveToOutput 'nsight-systems/${versionString}/${hostDir}' "''${!outputBin}" moveToOutput 'nsight-systems/${versionString}/${targetDir}' "''${!outputBin}" moveToOutput 'nsight-systems/${versionString}/bin' "''${!outputBin}" substituteInPlace $bin/bin/nsys $bin/bin/nsys-ui \ --replace-fail 'nsight-systems-#VERSION_RSPLIT#' nsight-systems/${versionString} wrapQtApp "$bin/nsight-systems/${versionString}/${hostDir}/nsys-ui.bin" postInstall = prevAttrs.postInstall or "" + '' moveToOutput '${hostDir}' "''${!outputBin}" moveToOutput '${targetDir}' "''${!outputBin}" moveToOutput 'bin' "''${!outputBin}" wrapQtApp "''${!outputBin}/${hostDir}/nsys-ui.bin" ''; preFixup = prevAttrs.preFixup or "" + '' # lib needs libtiff.so.5, but nixpkgs provides libtiff.so.6 patchelf --replace-needed libtiff.so.5 libtiff.so $bin/nsight-systems/${versionString}/${hostDir}/Plugins/imageformats/libqtiff.so preFixup = prevAttrs.preFixup or "" + '' patchelf --replace-needed libtiff.so.5 libtiff.so "''${!outputBin}/${hostDir}/Plugins/imageformats/libqtiff.so" ''; autoPatchelfIgnoreMissingDeps = prevAttrs.autoPatchelfIgnoreMissingDeps or [ ] ++ [ Loading