From ddcde1fa9a72a67505f1005fc9043a44abc73989 Mon Sep 17 00:00:00 2001 From: "Ethan P." Date: Fri, 12 Sep 2025 18:06:39 -0700 Subject: [PATCH] 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. --- pkgs/by-name/mi/mission-center/package.nix | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkgs/by-name/mi/mission-center/package.nix b/pkgs/by-name/mi/mission-center/package.nix index 032229f82a60..d854f28325e1 100644 --- a/pkgs/by-name/mi/mission-center/package.nix +++ b/pkgs/by-name/mi/mission-center/package.nix @@ -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 ] }" '';