summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--assets/nvidia-nsight-graphics.pngbin0 -> 17306 bytes
-rw-r--r--modules/common.nix2
-rw-r--r--pkgs/default.nix2
-rw-r--r--pkgs/ngfx.nix44
4 files changed, 47 insertions, 1 deletions
diff --git a/assets/nvidia-nsight-graphics.png b/assets/nvidia-nsight-graphics.png
new file mode 100644
index 0000000..06a4bfd
--- /dev/null
+++ b/assets/nvidia-nsight-graphics.png
Binary files differdiff --git a/modules/common.nix b/modules/common.nix
index 1878909..bb7c65d 100644
--- a/modules/common.nix
+++ b/modules/common.nix
@@ -83,7 +83,7 @@
   ]) ++ (with unstablePkgs; [
     davinci-resolve muse-sounds-manager
   ]) ++ (with auxiliaryPkgs; [
-    ghidra
+    ghidra ngfx
   ]);
 
   environment.etc.openvpn.source = "${pkgs.update-resolv-conf}/libexec/openvpn";
diff --git a/pkgs/default.nix b/pkgs/default.nix
index 104a92d..80804bf 100644
--- a/pkgs/default.nix
+++ b/pkgs/default.nix
@@ -13,4 +13,6 @@ rec {
     element-desktop;
 
   ghidra = unstablePkgs.callPackage ./ghidra {};
+  
+  ngfx = pkgs.callPackage ./ngfx.nix {};
 }
diff --git a/pkgs/ngfx.nix b/pkgs/ngfx.nix
new file mode 100644
index 0000000..d01bc21
--- /dev/null
+++ b/pkgs/ngfx.nix
@@ -0,0 +1,44 @@
+{
+  lib, writeScriptBin, makeDesktopItem, symlinkJoin,
+  krb5, xcb-util-cursor, xorg, steam-run, ... 
+}:
+
+# Note that this package does not install NVIDIA Nsight Graphics
+# by itself, it needs to be installed to `/opt/nvidia` to work.
+
+# Wrapper script fixing Qt errors mostly taken from:
+# https://github.com/teevik/Config/blob/main/modules/home/development/glsl/default.nix
+let
+  libPath = lib.makeLibraryPath [
+    krb5 # libgssapi_krb5.so.2
+    xcb-util-cursor # libxcb-cursor.so.0
+    xorg.xcbutilimage # libxcb-image.so.0
+    xorg.xcbutilkeysyms # libxcb-keysyms.so.1
+    xorg.xcbutilrenderutil # libxcb-render-util.so.0
+    xorg.xcbutilwm # libxcb-icccm.so.4
+  ];
+
+  # TODO: Make so it find the proper version itself...
+  nsightPath = "/opt/nvidia/NVIDIA-Nsight-Graphics-2024.2/host/linux-desktop-nomad-x64";
+
+  ngfx-wrapper-script = writeScriptBin "ngfx-wrapper" ''
+    ngfx_ui="${nsightPath}/ngfx-ui"
+    export LD_LIBRARY_PATH="''$LD_LIBRARY_PATH":"${nsightPath}":${libPath}
+    # Fixes:
+    # Could not find the Qt platform plugin "wayland" in ""
+    # Could not find the Qt platform plugin "xcb" in ""
+    export QT_PLUGIN_PATH="${nsightPath}/Plugins"
+    "${steam-run}"/bin/steam-run "''$ngfx_ui"
+  '';
+
+  ngfx-desktop = makeDesktopItem {
+    name = "ngfx-ui";
+    desktopName = "NVIDIA Nsight Graphics";
+    icon = ../assets/nvidia-nsight-graphics.png;
+    exec = "${ngfx-wrapper-script}/bin/ngfx-wrapper %f";
+  };
+
+in symlinkJoin {
+  name = "nvidia-nsight-graphics-wrapper";
+  paths = [ ngfx-wrapper-script ngfx-desktop ];
+}