mission-center: use RUSTFLAGS to link libGL and libvulkan

A less crude method than patching `$cargoDepsCopy`
This commit is contained in:
seth 2024-11-19 05:00:20 -05:00
parent 8b230d41d2
commit dd78a15b79
No known key found for this signature in database
GPG Key ID: D31BD0D494BBEE86

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