mission-center: use RUSTFLAGS to link libGL and libvulkan

A less crude method than patching `$cargoDepsCopy`

(cherry picked from commit dd78a15b79)
This commit is contained in:
seth 2024-11-19 05:00:20 -05:00 committed by github-actions[bot]
parent ae92632da9
commit cf5a1c3293

View File

@ -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";