summary refs log tree commit diff
path: root/pkgs/ngfx.nix
blob: d01bc219d5f6782ffedc2a5bace04b2e01f8bf5c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
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 ];
}