Skip to content

Commit

Permalink
cudaPackages.nsight_compute: incorporate NixOS#291471
Browse files Browse the repository at this point in the history
  • Loading branch information
Connor Baker authored and ConnorBaker committed Sep 13, 2024
1 parent b1491ee commit a8c4f83
Showing 1 changed file with 59 additions and 9 deletions.
68 changes: 59 additions & 9 deletions pkgs/development/cuda-modules/overrides/cuda/nsight_systems.nix
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
{
boost178,
cuda_cudart,
cudaOlder,
e2fsprogs,
gst_all_1,
lib,
nss,
numactl,
pulseaudio,
qt5 ? null,
qt5Packages ? null,
qt6 ? null,
qt6Packages ? null,
rdma-core,
ucx,
utils,
Expand All @@ -21,15 +25,20 @@ in
prevAttrs:
let
inherit (prevAttrs) version;
qt = if lib.strings.versionOlder prevAttrs.version "2022.4.2.1" then qt5 else qt6;
qtwayland =
if lib.versions.major qt.qtbase.version == "5" then
lib.getBin qt.qtwayland
else
lib.getLib qt.qtwayland;
qt = if versionOlder prevAttrs.version "2022.4.2.1" then qt5 else qt6;
qtPackages = if versionOlder prevAttrs.version "2022.4.2.1" then qt5 else qt6Packages;
qtwayland = lib.getBin qtPackages.qtwayland;
qtWaylandPlugins = "${qtwayland}/${qt.qtbase.qtPluginPrefix}";
inherit (qtPackages)
qtbase
qtpositioning
qtscxml
qttools
qtwebengine
;
in
{
allowFHSReferences = true;
# An ad hoc replacement for
# https://github.com/ConnorBaker/cuda-redist-find-features/issues/11
env = prevAttrs.env or { } // {
Expand All @@ -38,32 +47,43 @@ in
"nsight-systems/*/*/lib{ssl,ssh,crypto}*"
"nsight-systems/*/*/libboost*"
"nsight-systems/*/*/libexec"
"nsight-systems/*/*/libQt*"
"nsight-systems/*/*/libQt6*"
"nsight-systems/*/*/libstdc*"
"nsight-systems/*/*/Mesa"
"nsight-systems/*/*/Plugins"
"nsight-systems/*/*/python/bin/python"
];
};

postPatch =
prevAttrs.postPatch or ""
+ ''
for path in $rmPatterns; do
rm -r "$path"
done
''
+ ''
patchShebangs nsight-systems
'';

nativeBuildInputs = prevAttrs.nativeBuildInputs ++ [ qt.wrapQtAppsHook ];

buildInputs = prevAttrs.buildInputs ++ [
(qt.qtdeclarative or qt.full)
(qt.qtsvg or qt.full)
boost178
cuda_cudart
e2fsprogs
gst_all_1.gst-plugins-base
gst_all_1.gstreamer
nss
numactl
pulseaudio
qt.qtbase
qtbase
qtWaylandPlugins
qtpositioning
qtscxml
qttools
qtwebengine
rdma-core
ucx
wayland
Expand All @@ -73,6 +93,36 @@ in
xorg.libXtst
];

postInstall =
# 1. Move dependencies of nsys, nsys-ui binaries to bin output
# 2. Fix paths in wrapper scripts
let
versionString = utils.majorMinorPatch prevAttrs.version;
in
prevAttrs.postInstall or ""
+ ''
moveToOutput 'nsight-systems/${versionString}/host-linux-*' "''${!outputBin}"
moveToOutput 'nsight-systems/${versionString}/target-linux-*' "''${!outputBin}"
substituteInPlace $bin/bin/nsys $bin/bin/nsys-ui \
--replace-fail 'nsight-systems-#VERSION_RSPLIT#' nsight-systems/${versionString}
for qtlib in $bin/nsight-systems/${versionString}/host-linux-x64/Plugins/*/libq*.so; do
qtdir=$(basename $(dirname $qtlib))
filename=$(basename $qtlib)
for qtpkgdir in ${
lib.concatMapStringsSep " " (x: qt6Packages.${x}) [
"qtbase"
"qtimageformats"
"qtsvg"
"qtwayland"
]
}; do
if [ -e $qtpkgdir/lib/qt-6/plugins/$qtdir/$filename ]; then
ln -snf $qtpkgdir/lib/qt-6/plugins/$qtdir/$filename $qtlib
fi
done
done
'';

brokenConditions = prevAttrs.brokenConditions // {
# Older releases require boost 1.70, which is deprecated in Nixpkgs
"CUDA too old (<11.8)" = cudaOlder "11.8";
Expand Down

0 comments on commit a8c4f83

Please sign in to comment.