1Index: kinit-5.32.0/src/kdeinit/kinit.cpp
2===================================================================
3--- kinit-5.32.0.orig/src/kdeinit/kinit.cpp
4+++ kinit-5.32.0/src/kdeinit/kinit.cpp
5@@ -623,19 +623,15 @@ static pid_t launch(int argc, const char
6
7 if (!libpath.isEmpty()) {
8 if (libpath_relative) {
9- // NB: Because Qt makes the actual dlopen() call, the
10- // RUNPATH of kdeinit is *not* respected - see
11- // https://sourceware.org/bugzilla/show_bug.cgi?id=13945
12- // - so we try hacking it in ourselves
13- QString install_lib_dir = QFile::decodeName(
14- CMAKE_INSTALL_PREFIX "/" LIB_INSTALL_DIR "/");
15- QString orig_libpath = libpath;
16- libpath = install_lib_dir + libpath;
17- l.setFileName(libpath);
18- if (!l.load()) {
19- libpath = orig_libpath;
20- l.setFileName(libpath);
21- l.load();
22+ // Try to load the library relative to the active profiles.
23+ QByteArrayList profiles = qgetenv("NIX_PROFILES").split(' ');
24+ // Reverse the profile list.
25+ std::reverse(profiles.begin(), profiles.end());
26+ for (const QByteArray &profile: profiles) {
27+ if (!profile.isEmpty()) {
28+ l.setFileName(QFile::decodeName(profile) + QStringLiteral("/lib/") + libpath);
29+ if (l.load()) break;
30+ }
31 }
32 } else {
33 l.load();