mission-center: add GPU drivers to LD_LIBRARY_PATH

This fixes an issue where NVIDIA cards will not show up on NixOS.

Under the hood, missioncenter-magpie executable uses nvtop to read
information for and stats about GPU devices. nvtop uses `dlopen` to
load vendor-specific libraries at runtime. For NVIDIA cards, this
requires having the appropriate version of `libnvidia-ml.so` available
under the LD_LIBRARY_PATH or RUNPATH.

Ideally, we would use `addDriverRunpath` directly to edit the
`missioncenter-magpie` RUNPATH. We instead have to wrap it with an
updated LD_LIBRARY_PATH to include the path which `addDriverRunpath`
would have added, as `$out/bin/missioncenter-magpie` is actually an
executable wrapper created by the `wrapGAppsHook4` hook.
This commit is contained in:
Ethan P.
2025-09-12 18:06:39 -07:00
parent ad4e6dd68c
commit ddcde1fa9a
@@ -39,6 +39,7 @@
wayland,
# magpie wrapper
addDriverRunpath,
libGL,
vulkan-loader,
@@ -128,6 +129,7 @@ stdenv.mkDerivation (finalAttrs: {
};
nativeBuildInputs = [
addDriverRunpath
blueprint-compiler
cargo
libxml2
@@ -178,6 +180,10 @@ stdenv.mkDerivation (finalAttrs: {
libGL
libdrm
vulkan-loader
# NVIDIA support requires linking libnvidia-ml.so at runtime:
# https://github.com/Syllo/nvtop/blob/3.2.0/src/extract_gpuinfo_nvidia.c#L274-L276
addDriverRunpath.driverLink
]
}"
'';