From dd78a15b79aa3f741d16deadf209f6074938af82 Mon Sep 17 00:00:00 2001 From: seth Date: Tue, 19 Nov 2024 05:00:20 -0500 Subject: [PATCH] mission-center: use RUSTFLAGS to link libGL and libvulkan A less crude method than patching `$cargoDepsCopy` --- pkgs/by-name/mi/mission-center/package.nix | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/pkgs/by-name/mi/mission-center/package.nix b/pkgs/by-name/mi/mission-center/package.nix index b21baead3379..4067bee90eda 100644 --- a/pkgs/by-name/mi/mission-center/package.nix +++ b/pkgs/by-name/mi/mission-center/package.nix @@ -35,9 +35,8 @@ pango, sqlite, udev, - wayland, - vulkan-loader, + wayland, versionCheckHook, }: @@ -111,6 +110,7 @@ stdenv.mkDerivation rec { pango sqlite udev + vulkan-loader wayland ]; @@ -118,12 +118,6 @@ stdenv.mkDerivation rec { substituteInPlace src/sys_info_v2/gatherer.rs \ --replace-fail '"missioncenter-gatherer"' '"${placeholder "out"}/bin/missioncenter-gatherer"' - substituteInPlace $cargoDepsCopy/gl_loader-*/src/glad.c \ - --replace-fail "libGL.so.1" "${libGL}/lib/libGL.so.1" - - substituteInPlace $cargoDepsCopy/ash-*/src/entry.rs \ - --replace-fail '"libvulkan.so.1"' '"${vulkan-loader}/lib/libvulkan.so.1"' - SRC_GATHERER=$NIX_BUILD_TOP/source/src/sys_info_v2/gatherer SRC_GATHERER_NVTOP=$SRC_GATHERER/3rdparty/nvtop @@ -151,6 +145,18 @@ stdenv.mkDerivation rec { versionCheckProgram = "${builtins.placeholder "out"}/bin/${meta.mainProgram}"; doInstallCheck = true; + env = { + # Make sure libGL and libvulkan can be found by dlopen() + RUSTFLAGS = toString ( + map (flag: "-C link-arg=" + flag) [ + "-Wl,--push-state,--no-as-needed" + "-lGL" + "-lvulkan" + "-Wl,--pop-state" + ] + ); + }; + meta = { description = "Monitor your CPU, Memory, Disk, Network and GPU usage"; homepage = "https://gitlab.com/mission-center-devs/mission-center";