summary refs log tree commit diff
path: root/pkgs/development/libraries/qt-5/5.6/qtbase.patch
blob: 0e21a17665b60ad10a0159957f07bb3bae8613a2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
diff --git a/mkspecs/features/create_cmake.prf b/mkspecs/features/create_cmake.prf
index 11fb52a0b1..a4cca1fdcb 100644
--- a/mkspecs/features/create_cmake.prf
+++ b/mkspecs/features/create_cmake.prf
@@ -21,7 +21,7 @@ load(cmake_functions)
 # at cmake time whether package has been found via a symlink, and correct
 # that to an absolute path. This is only done for installations to
 # the /usr or / prefix.
-CMAKE_INSTALL_LIBS_DIR = $$cmakeTargetPath($$[QT_INSTALL_LIBS])
+CMAKE_INSTALL_LIBS_DIR = $$cmakeTargetPath($$NIX_OUTPUT_OUT/lib/)
 contains(CMAKE_INSTALL_LIBS_DIR, ^(/usr)?/lib(64)?.*): CMAKE_USR_MOVE_WORKAROUND = $$CMAKE_INSTALL_LIBS_DIR
 
 CMAKE_OUT_DIR = $$MODULE_BASE_OUTDIR/lib/cmake
@@ -47,47 +47,22 @@ split_incpath {
         $$cmake_extra_source_includes.output
 }
 
-CMAKE_INCLUDE_DIR = $$cmakeRelativePath($$[QT_INSTALL_HEADERS], $$[QT_INSTALL_PREFIX])
-contains(CMAKE_INCLUDE_DIR, "^\\.\\./.*") {
-    CMAKE_INCLUDE_DIR = $$[QT_INSTALL_HEADERS]/
-    CMAKE_INCLUDE_DIR_IS_ABSOLUTE = True
-}
+CMAKE_INCLUDE_DIR = $$NIX_OUTPUT_DEV/include/
+CMAKE_INCLUDE_DIR_IS_ABSOLUTE = True
 
 !exists($$first(QT.$${MODULE}_private.includes)): CMAKE_NO_PRIVATE_INCLUDES = true
 
-CMAKE_LIB_DIR = $$cmakeRelativePath($$[QT_INSTALL_LIBS], $$[QT_INSTALL_PREFIX])
-contains(CMAKE_LIB_DIR,"^\\.\\./.*") {
-    CMAKE_LIB_DIR = $$[QT_INSTALL_LIBS]/
-    CMAKE_LIB_DIR_IS_ABSOLUTE = True
-} else {
-    CMAKE_RELATIVE_INSTALL_LIBS_DIR = $$cmakeRelativePath($$[QT_INSTALL_PREFIX], $$[QT_INSTALL_LIBS])
-    # We need to go up another two levels because the CMake files are
-    # installed in $${CMAKE_LIB_DIR}/cmake/Qt5$${CMAKE_MODULE_NAME}
-    CMAKE_RELATIVE_INSTALL_DIR = "$${CMAKE_RELATIVE_INSTALL_LIBS_DIR}../../"
-}
+CMAKE_LIB_DIR = $$NIX_OUTPUT_DEV/lib/
+CMAKE_LIB_DIR_IS_ABSOLUTE = True
 
-CMAKE_BIN_DIR = $$cmakeRelativePath($$[QT_HOST_BINS], $$[QT_INSTALL_PREFIX])
-contains(CMAKE_BIN_DIR, "^\\.\\./.*") {
-    CMAKE_BIN_DIR = $$[QT_HOST_BINS]/
-    CMAKE_BIN_DIR_IS_ABSOLUTE = True
-}
+CMAKE_BIN_DIR = $$NIX_OUTPUT_BIN/bin/
+CMAKE_BIN_DIR_IS_ABSOLUTE = True
 
-CMAKE_PLUGIN_DIR = $$cmakeRelativePath($$[QT_INSTALL_PLUGINS], $$[QT_INSTALL_PREFIX])
-contains(CMAKE_PLUGIN_DIR, "^\\.\\./.*") {
-    CMAKE_PLUGIN_DIR = $$[QT_INSTALL_PLUGINS]/
-    CMAKE_PLUGIN_DIR_IS_ABSOLUTE = True
-}
+CMAKE_PLUGIN_DIR = $$NIX_OUTPUT_PLUGIN/
+CMAKE_PLUGIN_DIR_IS_ABSOLUTE = True
 
-win32:!wince:!static:!staticlib {
-    CMAKE_DLL_DIR = $$cmakeRelativePath($$[QT_INSTALL_BINS], $$[QT_INSTALL_PREFIX])
-    contains(CMAKE_DLL_DIR, "^\\.\\./.*") {
-        CMAKE_DLL_DIR = $$[QT_INSTALL_BINS]/
-        CMAKE_DLL_DIR_IS_ABSOLUTE = True
-    }
-} else {
-    CMAKE_DLL_DIR = $$CMAKE_LIB_DIR
-    CMAKE_DLL_DIR_IS_ABSOLUTE = $$CMAKE_LIB_DIR_IS_ABSOLUTE
-}
+CMAKE_DLL_DIR = $$NIX_OUTPUT_DEV/lib/
+CMAKE_DLL_DIR_IS_ABSOLUTE = True
 
 static|staticlib:CMAKE_STATIC_TYPE = true
 
@@ -167,7 +142,7 @@ contains(CONFIG, plugin) {
       cmake_target_file
 
     cmake_qt5_plugin_file.files = $$cmake_target_file.output
-    cmake_qt5_plugin_file.path = $$[QT_INSTALL_LIBS]/cmake/Qt5$${CMAKE_MODULE_NAME}
+    cmake_qt5_plugin_file.path = $$NIX_OUTPUT_OUT/lib/cmake/Qt5$${CMAKE_MODULE_NAME}
     INSTALLS += cmake_qt5_plugin_file
 
     return()
@@ -314,7 +289,7 @@ exists($$cmake_macros_file.input) {
     cmake_qt5_module_files.files += $$cmake_macros_file.output
 }
 
-cmake_qt5_module_files.path = $$[QT_INSTALL_LIBS]/cmake/Qt5$${CMAKE_MODULE_NAME}
+cmake_qt5_module_files.path = $$NIX_OUTPUT_OUT/lib/cmake/Qt5$${CMAKE_MODULE_NAME}
 
 # We are generating cmake files. Most developers of Qt are not aware of cmake,
 # so we require automatic tests to be available. The only module which should
diff --git a/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in b/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in
index d2358cae4b..61d8cc0471 100644
--- a/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in
+++ b/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in
@@ -9,30 +9,6 @@ if (CMAKE_VERSION VERSION_LESS 3.0.0)
 endif()
 !!ENDIF
 
-!!IF !isEmpty(CMAKE_USR_MOVE_WORKAROUND)
-!!IF !isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
-set(_qt5$${CMAKE_MODULE_NAME}_install_prefix \"$$[QT_INSTALL_PREFIX]\")
-!!ELSE
-get_filename_component(_IMPORT_PREFIX \"${CMAKE_CURRENT_LIST_FILE}\" PATH)
-# Use original install prefix when loaded through a
-# cross-prefix symbolic link such as /lib -> /usr/lib.
-get_filename_component(_realCurr \"${_IMPORT_PREFIX}\" REALPATH)
-get_filename_component(_realOrig \"$$CMAKE_INSTALL_LIBS_DIR/cmake/Qt5$${CMAKE_MODULE_NAME}\" REALPATH)
-if(_realCurr STREQUAL _realOrig)
-    get_filename_component(_qt5$${CMAKE_MODULE_NAME}_install_prefix \"$$CMAKE_INSTALL_LIBS_DIR/$${CMAKE_RELATIVE_INSTALL_LIBS_DIR}\" ABSOLUTE)
-else()
-    get_filename_component(_qt5$${CMAKE_MODULE_NAME}_install_prefix \"${CMAKE_CURRENT_LIST_DIR}/$${CMAKE_RELATIVE_INSTALL_DIR}\" ABSOLUTE)
-endif()
-unset(_realOrig)
-unset(_realCurr)
-unset(_IMPORT_PREFIX)
-!!ENDIF
-!!ELIF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
-get_filename_component(_qt5$${CMAKE_MODULE_NAME}_install_prefix \"${CMAKE_CURRENT_LIST_DIR}/$${CMAKE_RELATIVE_INSTALL_DIR}\" ABSOLUTE)
-!!ELSE
-set(_qt5$${CMAKE_MODULE_NAME}_install_prefix \"$$[QT_INSTALL_PREFIX]\")
-!!ENDIF
-
 !!IF !equals(TEMPLATE, aux)
 # For backwards compatibility only. Use Qt5$${CMAKE_MODULE_NAME}_VERSION instead.
 set(Qt5$${CMAKE_MODULE_NAME}_VERSION_STRING "$$eval(QT.$${MODULE}.MAJOR_VERSION).$$eval(QT.$${MODULE}.MINOR_VERSION).$$eval(QT.$${MODULE}.PATCH_VERSION)")
@@ -58,11 +34,7 @@ endmacro()
 macro(_populate_$${CMAKE_MODULE_NAME}_target_properties Configuration LIB_LOCATION IMPLIB_LOCATION)
     set_property(TARGET Qt5::$${CMAKE_MODULE_NAME} APPEND PROPERTY IMPORTED_CONFIGURATIONS ${Configuration})
 
-!!IF isEmpty(CMAKE_DLL_DIR_IS_ABSOLUTE)
-    set(imported_location \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_DLL_DIR}${LIB_LOCATION}\")
-!!ELSE
     set(imported_location \"$${CMAKE_DLL_DIR}${LIB_LOCATION}\")
-!!ENDIF
     _qt5_$${CMAKE_MODULE_NAME}_check_file_exists(${imported_location})
     set_target_properties(Qt5::$${CMAKE_MODULE_NAME} PROPERTIES
         \"INTERFACE_LINK_LIBRARIES\" \"${_Qt5$${CMAKE_MODULE_NAME}_LIB_DEPENDENCIES}\"
@@ -75,11 +47,7 @@ macro(_populate_$${CMAKE_MODULE_NAME}_target_properties Configuration LIB_LOCATI
     )
 
 !!IF !isEmpty(CMAKE_WINDOWS_BUILD)
-!!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
-    set(imported_implib \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}${IMPLIB_LOCATION}\")
-!!ELSE
     set(imported_implib \"IMPORTED_IMPLIB_${Configuration}\" \"$${CMAKE_LIB_DIR}${IMPLIB_LOCATION}\")
-!!ENDIF
     _qt5_$${CMAKE_MODULE_NAME}_check_file_exists(${imported_implib})
     if(NOT \"${IMPLIB_LOCATION}\" STREQUAL \"\")
         set_target_properties(Qt5::$${CMAKE_MODULE_NAME} PROPERTIES
@@ -95,24 +63,13 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME})
 !!IF !no_module_headers
 !!IF !isEmpty(CMAKE_BUILD_IS_FRAMEWORK)
     set(_Qt5$${CMAKE_MODULE_NAME}_OWN_INCLUDE_DIRS
-      \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}Qt$${CMAKE_MODULE_NAME}.framework\"
-      \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}Qt$${CMAKE_MODULE_NAME}.framework/Headers\"
+      \"$${CMAKE_LIB_DIR}Qt$${CMAKE_MODULE_NAME}.framework\"
+      \"$${CMAKE_LIB_DIR}Qt$${CMAKE_MODULE_NAME}.framework/Headers\"
     )
 !!IF isEmpty(CMAKE_NO_PRIVATE_INCLUDES)
     set(Qt5$${CMAKE_MODULE_NAME}_PRIVATE_INCLUDE_DIRS
-        \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}Qt$${CMAKE_MODULE_NAME}.framework/Versions/$$section(VERSION, ., 0, 0)/Headers/$$VERSION/\"
-        \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}Qt$${CMAKE_MODULE_NAME}.framework/Versions/$$section(VERSION, ., 0, 0)/Headers/$$VERSION/$${MODULE_INCNAME}\"
-    )
-!!ELSE
-    set(Qt5$${CMAKE_MODULE_NAME}_PRIVATE_INCLUDE_DIRS \"\")
-!!ENDIF
-!!ELSE
-!!IF isEmpty(CMAKE_INCLUDE_DIR_IS_ABSOLUTE)
-    set(_Qt5$${CMAKE_MODULE_NAME}_OWN_INCLUDE_DIRS \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$$CMAKE_INCLUDE_DIR\" \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_INCLUDE_DIR}$${MODULE_INCNAME}\")
-!!IF isEmpty(CMAKE_NO_PRIVATE_INCLUDES)
-    set(Qt5$${CMAKE_MODULE_NAME}_PRIVATE_INCLUDE_DIRS
-        \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_INCLUDE_DIR}$${MODULE_INCNAME}/$$VERSION\"
-        \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_INCLUDE_DIR}$${MODULE_INCNAME}/$$VERSION/$${MODULE_INCNAME}\"
+        \"$${CMAKE_LIB_DIR}Qt$${CMAKE_MODULE_NAME}.framework/Versions/$$section(VERSION, ., 0, 0)/Headers/$$VERSION/\"
+        \"$${CMAKE_LIB_DIR}Qt$${CMAKE_MODULE_NAME}.framework/Versions/$$section(VERSION, ., 0, 0)/Headers/$$VERSION/$${MODULE_INCNAME}\"
     )
 !!ELSE
     set(Qt5$${CMAKE_MODULE_NAME}_PRIVATE_INCLUDE_DIRS \"\")
@@ -128,7 +85,6 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME})
     set(Qt5$${CMAKE_MODULE_NAME}_PRIVATE_INCLUDE_DIRS \"\")
 !!ENDIF
 !!ENDIF
-!!ENDIF
 !!IF !isEmpty(CMAKE_ADD_SOURCE_INCLUDE_DIRS)
     include(\"${CMAKE_CURRENT_LIST_DIR}/ExtraSourceIncludes.cmake\" OPTIONAL)
 !!ENDIF
@@ -254,25 +210,13 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME})
 !!IF !isEmpty(CMAKE_FIND_OTHER_LIBRARY_BUILD)
 !!IF isEmpty(CMAKE_DEBUG_TYPE)
 !!IF !isEmpty(CMAKE_STATIC_WINDOWS_BUILD)
-!!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
-    if (EXISTS \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" )
-!!ELSE // CMAKE_LIB_DIR_IS_ABSOLUTE
     if (EXISTS \"$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" )
-!!ENDIF // CMAKE_LIB_DIR_IS_ABSOLUTE
         _populate_$${CMAKE_MODULE_NAME}_target_properties(DEBUG \"$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" \"\" )
 !!ELSE // CMAKE_STATIC_WINDOWS_BUILD
     if (EXISTS
-!!IF isEmpty(CMAKE_DLL_DIR_IS_ABSOLUTE)
-        \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_DLL_DIR}$${CMAKE_LIB_FILE_LOCATION_DEBUG}\"
-!!ELSE
         \"$${CMAKE_LIB_FILE_LOCATION_DEBUG}\"
-!!ENDIF
       AND EXISTS
-!!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
-        \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" )
-!!ELSE
         \"$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" )
-!!ENDIF
         _populate_$${CMAKE_MODULE_NAME}_target_properties(DEBUG \"$${CMAKE_LIB_FILE_LOCATION_DEBUG}\" \"$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" )
 !!ENDIF // CMAKE_STATIC_WINDOWS_BUILD
     endif()
@@ -291,25 +235,13 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME})
 !!IF !isEmpty(CMAKE_FIND_OTHER_LIBRARY_BUILD)
 !!IF isEmpty(CMAKE_RELEASE_TYPE)
 !!IF !isEmpty(CMAKE_STATIC_WINDOWS_BUILD)
-!!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
-    if (EXISTS \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" )
-!!ELSE // CMAKE_LIB_DIR_IS_ABSOLUTE
     if (EXISTS \"$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" )
-!!ENDIF // CMAKE_LIB_DIR_IS_ABSOLUTE
         _populate_$${CMAKE_MODULE_NAME}_target_properties(RELEASE \"$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" \"\" )
 !!ELSE // CMAKE_STATIC_WINDOWS_BUILD
     if (EXISTS
-!!IF isEmpty(CMAKE_DLL_DIR_IS_ABSOLUTE)
-        \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_DLL_DIR}$${CMAKE_LIB_FILE_LOCATION_RELEASE}\"
-!!ELSE
         \"$${CMAKE_LIB_FILE_LOCATION_RELEASE}\"
-!!ENDIF
       AND EXISTS
-!!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
-        \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" )
-!!ELSE
         \"$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" )
-!!ENDIF
         _populate_$${CMAKE_MODULE_NAME}_target_properties(RELEASE \"$${CMAKE_LIB_FILE_LOCATION_RELEASE}\" \"$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" )
 !!ENDIF // CMAKE_STATIC_WINDOWS_BUILD
     endif()
@@ -328,11 +260,7 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME})
     macro(_populate_$${CMAKE_MODULE_NAME}_plugin_properties Plugin Configuration PLUGIN_LOCATION)
         set_property(TARGET Qt5::${Plugin} APPEND PROPERTY IMPORTED_CONFIGURATIONS ${Configuration})
 
-!!IF isEmpty(CMAKE_PLUGIN_DIR_IS_ABSOLUTE)
-        set(imported_location \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_PLUGIN_DIR}${PLUGIN_LOCATION}\")
-!!ELSE
         set(imported_location \"$${CMAKE_PLUGIN_DIR}${PLUGIN_LOCATION}\")
-!!ENDIF
         _qt5_$${CMAKE_MODULE_NAME}_check_file_exists(${imported_location})
         set_target_properties(Qt5::${Plugin} PROPERTIES
             \"IMPORTED_LOCATION_${Configuration}\" ${imported_location}
diff --git a/mkspecs/features/qml_module.prf b/mkspecs/features/qml_module.prf
index b09d42a0a4..f076265bdd 100644
--- a/mkspecs/features/qml_module.prf
+++ b/mkspecs/features/qml_module.prf
@@ -17,10 +17,7 @@ fq_qml_files = $$_PRO_FILE_PWD_/qmldir
 
 for(qmlf, QML_FILES): fq_qml_files += $$absolute_path($$qmlf, $$_PRO_FILE_PWD_)
 
-qml1_target: \
-    instbase = $$[QT_INSTALL_IMPORTS]
-else: \
-    instbase = $$[QT_INSTALL_QML]
+instbase = $$NIX_OUTPUT_QML
 
 # Install rules
 qmldir.base = $$_PRO_FILE_PWD_
diff --git a/mkspecs/features/qml_plugin.prf b/mkspecs/features/qml_plugin.prf
index ebec1db8da..62ace84a6c 100644
--- a/mkspecs/features/qml_plugin.prf
+++ b/mkspecs/features/qml_plugin.prf
@@ -46,13 +46,8 @@ exists($$QMLTYPEFILE): QML_FILES += $$QMLTYPEFILE
 
 load(qt_build_paths)
 
-qml1_target {
-    DESTDIR = $$MODULE_BASE_OUTDIR/imports/$$TARGETPATH
-    instbase = $$[QT_INSTALL_IMPORTS]
-} else {
-    DESTDIR = $$MODULE_BASE_OUTDIR/qml/$$TARGETPATH
-    instbase = $$[QT_INSTALL_QML]
-}
+DESTDIR = $$MODULE_BASE_OUTDIR/qml/$$TARGETPATH
+instbase = $$NIX_OUTPUT_QML
 
 target.path = $$instbase/$$TARGETPATH
 INSTALLS += target
diff --git a/mkspecs/features/qt_app.prf b/mkspecs/features/qt_app.prf
index 46aca50cc2..4f4e634724 100644
--- a/mkspecs/features/qt_app.prf
+++ b/mkspecs/features/qt_app.prf
@@ -29,7 +29,7 @@ host_build:force_bootstrap {
     target.path = $$[QT_HOST_BINS]
 } else {
     !build_pass:contains(QT_CONFIG, debug_and_release): CONFIG += release
-    target.path = $$[QT_INSTALL_BINS]
+    target.path = $$NIX_OUTPUT_BIN/bin
     CONFIG += relative_qt_rpath  # Qt's tools and apps should be relocatable
 }
 INSTALLS += target
diff --git a/mkspecs/features/qt_build_paths.prf b/mkspecs/features/qt_build_paths.prf
index 1848f00e90..2af93675c5 100644
--- a/mkspecs/features/qt_build_paths.prf
+++ b/mkspecs/features/qt_build_paths.prf
@@ -23,6 +23,6 @@ exists($$MODULE_BASE_INDIR/.git): \
 !force_independent {
     # If the module is not built independently, everything ends up in qtbase.
     # This is the case in non-prefix builds, except for selected modules.
-    MODULE_BASE_OUTDIR = $$[QT_HOST_PREFIX]
-    MODULE_QMAKE_OUTDIR = $$[QT_HOST_PREFIX]
+    MODULE_BASE_OUTDIR = $$NIX_OUTPUT_OUT
+    MODULE_QMAKE_OUTDIR = $$NIX_OUTPUT_OUT
 }
diff --git a/mkspecs/features/qt_common.prf b/mkspecs/features/qt_common.prf
index c1809468af..0a12ec24db 100644
--- a/mkspecs/features/qt_common.prf
+++ b/mkspecs/features/qt_common.prf
@@ -30,8 +30,8 @@ contains(TEMPLATE, .*lib) {
         qqt_libdir = \$\$\$\$[QT_HOST_LIBS]
         qt_libdir = $$[QT_HOST_LIBS]
     } else {
-        qqt_libdir = \$\$\$\$[QT_INSTALL_LIBS]
-        qt_libdir = $$[QT_INSTALL_LIBS]
+        qqt_libdir = \$\$\$\$NIX_OUTPUT_OUT/lib
+        qt_libdir = $$NIX_OUTPUT_OUT/lib
     }
     contains(QMAKE_DEFAULT_LIBDIRS, $$qt_libdir) {
         lib_replace.match = "[^ ']*$$rplbase/lib"
diff --git a/mkspecs/features/qt_docs.prf b/mkspecs/features/qt_docs.prf
index 183d0c9502..17982b04ec 100644
--- a/mkspecs/features/qt_docs.prf
+++ b/mkspecs/features/qt_docs.prf
@@ -41,7 +41,7 @@ QMAKE_DOCS_OUTPUTDIR = $$QMAKE_DOCS_BASE_OUTDIR/$$QMAKE_DOCS_TARGETDIR
 
 QDOC += -outputdir $$shell_quote($$QMAKE_DOCS_OUTPUTDIR)
 !build_online_docs: \
-    QDOC += -installdir $$shell_quote($$[QT_INSTALL_DOCS])
+    QDOC += -installdir $$shell_quote($$NIX_OUTPUT_DOC)
 PREP_DOC_INDEXES =
 DOC_INDEXES =
 !isEmpty(QTREPOS) {
@@ -60,8 +60,8 @@ DOC_INDEXES =
         DOC_INDEXES += -indexdir $$shell_quote($$qrep/doc)
 } else {
     prepare_docs: \
-        PREP_DOC_INDEXES += -indexdir $$shell_quote($$[QT_INSTALL_DOCS/get])
-    DOC_INDEXES += -indexdir $$shell_quote($$[QT_INSTALL_DOCS/get])
+        PREP_DOC_INDEXES += -indexdir $$shell_quote($$NIX_OUTPUT_DOC)
+    DOC_INDEXES += -indexdir $$shell_quote($$NIX_OUTPUT_DOC)
 }
 doc_command = $$QDOC $$QMAKE_DOCS
 prepare_docs {
@@ -75,12 +75,12 @@ prepare_docs {
     qch_docs.commands = $$QHELPGENERATOR $$shell_quote($$QMAKE_DOCS_OUTPUTDIR/$${QMAKE_DOCS_TARGET}.qhp) -o $$shell_quote($$QMAKE_DOCS_BASE_OUTDIR/$${QMAKE_DOCS_TARGET}.qch)
 
     inst_html_docs.files = $$QMAKE_DOCS_OUTPUTDIR
-    inst_html_docs.path = $$[QT_INSTALL_DOCS]
+    inst_html_docs.path = $$NIX_OUTPUT_DOC
     inst_html_docs.CONFIG += no_check_exist directory no_default_install no_build
     INSTALLS += inst_html_docs
 
     inst_qch_docs.files = $$QMAKE_DOCS_BASE_OUTDIR/$${QMAKE_DOCS_TARGET}.qch
-    inst_qch_docs.path = $$[QT_INSTALL_DOCS]
+    inst_qch_docs.path = $$NIX_OUTPUT_DOC
     inst_qch_docs.CONFIG += no_check_exist no_default_install no_build
     INSTALLS += inst_qch_docs
 
diff --git a/mkspecs/features/qt_example_installs.prf b/mkspecs/features/qt_example_installs.prf
index 4c68cfd72f..f422f18266 100644
--- a/mkspecs/features/qt_example_installs.prf
+++ b/mkspecs/features/qt_example_installs.prf
@@ -70,7 +70,7 @@ probase = $$relative_path($$_PRO_FILE_PWD_, $$dirname(_QMAKE_CONF_)/examples)
         $$SOURCES $$HEADERS $$FORMS $$RESOURCES $$TRANSLATIONS \
         $$DBUS_ADAPTORS $$DBUS_INTERFACES
     addInstallFiles(sources.files, $$sourcefiles)
-    sources.path = $$[QT_INSTALL_EXAMPLES]/$$probase
+    sources.path = $$NIX_OUTPUT_DEV/share/examples/$$probase
     INSTALLS += sources
 
     check_examples {
diff --git a/mkspecs/features/qt_functions.prf b/mkspecs/features/qt_functions.prf
index 4a1d265a8b..abe0da95f6 100644
--- a/mkspecs/features/qt_functions.prf
+++ b/mkspecs/features/qt_functions.prf
@@ -70,7 +70,7 @@ defineTest(qtHaveModule) {
 defineTest(qtPrepareTool) {
     cmd = $$eval(QT_TOOL.$${2}.binary)
     isEmpty(cmd) {
-        cmd = $$[QT_HOST_BINS]/$$2
+        cmd = $$system("type -p $$2")
         exists($${cmd}.pl) {
             cmd = perl -w $$system_path($${cmd}.pl)
         } else: contains(QMAKE_HOST.os, Windows) {
diff --git a/mkspecs/features/qt_installs.prf b/mkspecs/features/qt_installs.prf
index 3a5dbb6274..24f321bd82 100644
--- a/mkspecs/features/qt_installs.prf
+++ b/mkspecs/features/qt_installs.prf
@@ -12,16 +12,10 @@
 #library
 !qt_no_install_library {
     win32 {
-       host_build: \
-           dlltarget.path = $$[QT_HOST_BINS]
-       else: \
-           dlltarget.path = $$[QT_INSTALL_BINS]
+        dlltarget.path = $$NIX_OUTPUT_BIN/bin
        INSTALLS += dlltarget
     }
-    host_build: \
-        target.path = $$[QT_HOST_LIBS]
-    else: \
-        target.path = $$[QT_INSTALL_LIBS]
+    target.path = $$NIX_OUTPUT_OUT/lib
     !static: target.CONFIG = no_dll
     INSTALLS += target
 }
@@ -29,33 +23,33 @@
 #headers
 qt_install_headers {
     class_headers.files = $$SYNCQT.HEADER_CLASSES
-    class_headers.path = $$[QT_INSTALL_HEADERS]/$$MODULE_INCNAME
+    class_headers.path = $$NIX_OUTPUT_DEV/include/$$MODULE_INCNAME
     INSTALLS += class_headers
 
     targ_headers.files = $$SYNCQT.HEADER_FILES
-    targ_headers.path = $$[QT_INSTALL_HEADERS]/$$MODULE_INCNAME
+    targ_headers.path = $$NIX_OUTPUT_DEV/include/$$MODULE_INCNAME
     INSTALLS += targ_headers
 
     private_headers.files = $$SYNCQT.PRIVATE_HEADER_FILES
-    private_headers.path = $$[QT_INSTALL_HEADERS]/$$MODULE_INCNAME/$$VERSION/$$MODULE_INCNAME/private
+    private_headers.path = $$NIX_OUTPUT_DEV/include/$$MODULE_INCNAME/$$VERSION/$$MODULE_INCNAME/private
     INSTALLS += private_headers
 
     qpa_headers.files = $$SYNCQT.QPA_HEADER_FILES
-    qpa_headers.path = $$[QT_INSTALL_HEADERS]/$$MODULE_INCNAME/$$VERSION/$$MODULE_INCNAME/qpa
+    qpa_headers.path = $$NIX_OUTPUT_DEV/include/$$MODULE_INCNAME/$$VERSION/$$MODULE_INCNAME/qpa
     INSTALLS += qpa_headers
 }
 
 #module
 qt_install_module {
     !isEmpty(MODULE_PRI) {
-        pritarget.path = $$[QT_HOST_DATA]/mkspecs/modules
+        pritarget.path = $$NIX_OUTPUT_DEV/mkspecs/modules
         pritarget.files = $$MODULE_PRI
         INSTALLS += pritarget
     } else: isEmpty(MODULE_PRIVATE_PRI) {
         warning("Project $$basename(_PRO_FILE_) is a module, but has not defined MODULE_PRI, which is required for Qt to expose the module to other projects.")
     }
     !isEmpty(MODULE_PRIVATE_PRI) {
-        privpritarget.path = $$[QT_HOST_DATA]/mkspecs/modules
+        privpritarget.path = $$NIX_OUTPUT_DEV/mkspecs/modules
         privpritarget.files = $$MODULE_PRIVATE_PRI
         INSTALLS += privpritarget
     }
diff --git a/mkspecs/features/qt_plugin.prf b/mkspecs/features/qt_plugin.prf
index 3cf6c7349c..83e68025a5 100644
--- a/mkspecs/features/qt_plugin.prf
+++ b/mkspecs/features/qt_plugin.prf
@@ -82,7 +82,7 @@ CONFIG(static, static|shared)|prefix_build {
     }
 }
 
-target.path = $$[QT_INSTALL_PLUGINS]/$$PLUGIN_TYPE
+target.path = $$NIX_OUTPUT_PLUGIN/$$PLUGIN_TYPE
 INSTALLS += target
 
 TARGET = $$qt5LibraryTarget($$TARGET)
diff --git a/src/corelib/Qt5CoreConfigExtras.cmake.in b/src/corelib/Qt5CoreConfigExtras.cmake.in
index 91a4eb619a..08b533e69c 100644
--- a/src/corelib/Qt5CoreConfigExtras.cmake.in
+++ b/src/corelib/Qt5CoreConfigExtras.cmake.in
@@ -3,7 +3,7 @@ if (NOT TARGET Qt5::qmake)
     add_executable(Qt5::qmake IMPORTED)
 
 !!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE)
-    set(imported_location \"${_qt5Core_install_prefix}/$${CMAKE_BIN_DIR}qmake$$CMAKE_BIN_SUFFIX\")
+    set(imported_location \"$$NIX_OUTPUT_DEV/$${CMAKE_BIN_DIR}qmake$$CMAKE_BIN_SUFFIX\")
 !!ELSE
     set(imported_location \"$${CMAKE_BIN_DIR}qmake$$CMAKE_BIN_SUFFIX\")
 !!ENDIF
@@ -18,7 +18,7 @@ if (NOT TARGET Qt5::moc)
     add_executable(Qt5::moc IMPORTED)
 
 !!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE)
-    set(imported_location \"${_qt5Core_install_prefix}/$${CMAKE_BIN_DIR}moc$$CMAKE_BIN_SUFFIX\")
+    set(imported_location \"$$NIX_OUTPUT_DEV/$${CMAKE_BIN_DIR}moc$$CMAKE_BIN_SUFFIX\")
 !!ELSE
     set(imported_location \"$${CMAKE_BIN_DIR}moc$$CMAKE_BIN_SUFFIX\")
 !!ENDIF
@@ -35,7 +35,7 @@ if (NOT TARGET Qt5::rcc)
     add_executable(Qt5::rcc IMPORTED)
 
 !!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE)
-    set(imported_location \"${_qt5Core_install_prefix}/$${CMAKE_BIN_DIR}rcc$$CMAKE_BIN_SUFFIX\")
+    set(imported_location \"$$NIX_OUTPUT_DEV/$${CMAKE_BIN_DIR}rcc$$CMAKE_BIN_SUFFIX\")
 !!ELSE
     set(imported_location \"$${CMAKE_BIN_DIR}rcc$$CMAKE_BIN_SUFFIX\")
 !!ENDIF
@@ -131,7 +131,7 @@ if (NOT TARGET Qt5::WinMain)
 !!IF !isEmpty(CMAKE_RELEASE_TYPE)
     set_property(TARGET Qt5::WinMain APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
 !!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
-    set(imported_location \"${_qt5Core_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_WINMAIN_FILE_LOCATION_RELEASE}\")
+    set(imported_location \"$$NIX_OUTPUT_DEV/$${CMAKE_LIB_DIR}$${CMAKE_WINMAIN_FILE_LOCATION_RELEASE}\")
 !!ELSE
     set(imported_location \"$${CMAKE_LIB_DIR}$${CMAKE_WINMAIN_FILE_LOCATION_RELEASE}\")
 !!ENDIF
@@ -145,7 +145,7 @@ if (NOT TARGET Qt5::WinMain)
     set_property(TARGET Qt5::WinMain APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG)
 
 !!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
-    set(imported_location \"${_qt5Core_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_WINMAIN_FILE_LOCATION_DEBUG}\")
+    set(imported_location \"$$NIX_OUTPUT_DEV/$${CMAKE_LIB_DIR}$${CMAKE_WINMAIN_FILE_LOCATION_DEBUG}\")
 !!ELSE
     set(imported_location \"$${CMAKE_LIB_DIR}$${CMAKE_WINMAIN_FILE_LOCATION_DEBUG}\")
 !!ENDIF
diff --git a/src/corelib/Qt5CoreConfigExtrasMkspecDir.cmake.in b/src/corelib/Qt5CoreConfigExtrasMkspecDir.cmake.in
index c357237d0e..6f0c75de3c 100644
--- a/src/corelib/Qt5CoreConfigExtrasMkspecDir.cmake.in
+++ b/src/corelib/Qt5CoreConfigExtrasMkspecDir.cmake.in
@@ -1,6 +1,6 @@
 
 !!IF isEmpty(CMAKE_HOST_DATA_DIR_IS_ABSOLUTE)
-set(_qt5_corelib_extra_includes \"${_qt5Core_install_prefix}/$${CMAKE_HOST_DATA_DIR}/mkspecs/$${CMAKE_MKSPEC}\")
+set(_qt5_corelib_extra_includes \"$$NIX_OUTPUT_DEV/$${CMAKE_HOST_DATA_DIR}/mkspecs/$${CMAKE_MKSPEC}\")
 !!ELSE
 set(_qt5_corelib_extra_includes \"$${CMAKE_HOST_DATA_DIR}mkspecs/$${CMAKE_MKSPEC}\")
 !!ENDIF
diff --git a/src/corelib/Qt5CoreConfigExtrasMkspecDirForInstall.cmake.in b/src/corelib/Qt5CoreConfigExtrasMkspecDirForInstall.cmake.in
index 706304cf34..546420f6ad 100644
--- a/src/corelib/Qt5CoreConfigExtrasMkspecDirForInstall.cmake.in
+++ b/src/corelib/Qt5CoreConfigExtrasMkspecDirForInstall.cmake.in
@@ -1,6 +1,6 @@
 
 !!IF isEmpty(CMAKE_INSTALL_DATA_DIR_IS_ABSOLUTE)
-set(_qt5_corelib_extra_includes \"${_qt5Core_install_prefix}/$${CMAKE_INSTALL_DATA_DIR}/mkspecs/$${CMAKE_MKSPEC}\")
+set(_qt5_corelib_extra_includes \"$$NIX_OUTPUT_DEV/$${CMAKE_INSTALL_DATA_DIR}/mkspecs/$${CMAKE_MKSPEC}\")
 !!ELSE
 set(_qt5_corelib_extra_includes \"$${CMAKE_INSTALL_DATA_DIR}mkspecs/$${CMAKE_MKSPEC}\")
 !!ENDIF
diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp
index f5b15207cc..f85e0524bb 100644
--- a/src/corelib/kernel/qcoreapplication.cpp
+++ b/src/corelib/kernel/qcoreapplication.cpp
@@ -2533,6 +2533,15 @@ QStringList QCoreApplication::libraryPaths()
         QStringList *app_libpaths = new QStringList;
         coreappdata()->app_libpaths.reset(app_libpaths);
 
+        // Add library paths derived from PATH
+        const QStringList paths = QFile::decodeName(qgetenv("PATH")).split(':');
+        const QString plugindir = QStringLiteral("../" NIXPKGS_QT_PLUGIN_PREFIX);
+        for (const QString &path: paths) {
+            if (!path.isEmpty()) {
+                app_libpaths->append(QDir::cleanPath(path + QDir::separator() + plugindir));
+            }
+        }
+
         const QByteArray libPathEnv = qgetenv("QT_PLUGIN_PATH");
         if (!libPathEnv.isEmpty()) {
             QStringList paths = QFile::decodeName(libPathEnv).split(QDir::listSeparator(), QString::SkipEmptyParts);
diff --git a/src/corelib/tools/qtimezoneprivate_tz.cpp b/src/corelib/tools/qtimezoneprivate_tz.cpp
index c13c9a5223..6936851511 100644
--- a/src/corelib/tools/qtimezoneprivate_tz.cpp
+++ b/src/corelib/tools/qtimezoneprivate_tz.cpp
@@ -64,7 +64,11 @@ typedef QHash<QByteArray, QTzTimeZone> QTzTimeZoneHash;
 // Parse zone.tab table, assume lists all installed zones, if not will need to read directories
 static QTzTimeZoneHash loadTzTimeZones()
 {
-    QString path = QStringLiteral("/usr/share/zoneinfo/zone.tab");
+    // Try TZDIR first, in case we're running on NixOS.
+    QString path = QFile::decodeName(qgetenv("TZDIR")) + QStringLiteral("/zone.tab");
+    // Fallback to traditional paths in case we are not on NixOS.
+    if (!QFile::exists(path))
+        path = QStringLiteral("/usr/share/zoneinfo/zone.tab");
     if (!QFile::exists(path))
         path = QStringLiteral("/usr/lib/zoneinfo/zone.tab");
 
@@ -636,12 +640,16 @@ void QTzTimeZonePrivate::init(const QByteArray &ianaId)
         if (!tzif.open(QIODevice::ReadOnly))
             return;
     } else {
-        // Open named tz, try modern path first, if fails try legacy path
-        tzif.setFileName(QLatin1String("/usr/share/zoneinfo/") + QString::fromLocal8Bit(ianaId));
+        // Try TZDIR first, in case we're running on NixOS
+        tzif.setFileName(QFile::decodeName(qgetenv("TZDIR")) + QStringLiteral("/") + QString::fromLocal8Bit(ianaId));
         if (!tzif.open(QIODevice::ReadOnly)) {
-            tzif.setFileName(QLatin1String("/usr/lib/zoneinfo/") + QString::fromLocal8Bit(ianaId));
-            if (!tzif.open(QIODevice::ReadOnly))
-                return;
+            // Open named tz, try modern path first, if fails try legacy path
+            tzif.setFileName(QLatin1String("/usr/share/zoneinfo/") + QString::fromLocal8Bit(ianaId));
+            if (!tzif.open(QIODevice::ReadOnly)) {
+                tzif.setFileName(QLatin1String("/usr/lib/zoneinfo/") + QString::fromLocal8Bit(ianaId));
+                if (!tzif.open(QIODevice::ReadOnly))
+                    return;
+            }
         }
     }
 
diff --git a/src/dbus/Qt5DBusConfigExtras.cmake.in b/src/dbus/Qt5DBusConfigExtras.cmake.in
index 1d947159e2..b36865fc48 100644
--- a/src/dbus/Qt5DBusConfigExtras.cmake.in
+++ b/src/dbus/Qt5DBusConfigExtras.cmake.in
@@ -2,11 +2,7 @@
 if (NOT TARGET Qt5::qdbuscpp2xml)
     add_executable(Qt5::qdbuscpp2xml IMPORTED)
 
-!!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE)
-    set(imported_location \"${_qt5DBus_install_prefix}/$${CMAKE_BIN_DIR}qdbuscpp2xml$$CMAKE_BIN_SUFFIX\")
-!!ELSE
-    set(imported_location \"$${CMAKE_BIN_DIR}qdbuscpp2xml$$CMAKE_BIN_SUFFIX\")
-!!ENDIF
+    set(imported_location \"$$NIX_OUTPUT_DEV/bin/qdbuscpp2xml$$CMAKE_BIN_SUFFIX\")
     _qt5_DBus_check_file_exists(${imported_location})
 
     set_target_properties(Qt5::qdbuscpp2xml PROPERTIES
@@ -17,11 +13,7 @@ endif()
 if (NOT TARGET Qt5::qdbusxml2cpp)
     add_executable(Qt5::qdbusxml2cpp IMPORTED)
 
-!!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE)
-    set(imported_location \"${_qt5DBus_install_prefix}/$${CMAKE_BIN_DIR}qdbusxml2cpp$$CMAKE_BIN_SUFFIX\")
-!!ELSE
-    set(imported_location \"$${CMAKE_BIN_DIR}qdbusxml2cpp$$CMAKE_BIN_SUFFIX\")
-!!ENDIF
+    set(imported_location \"$$NIX_OUTPUT_DEV/bin/qdbusxml2cpp$$CMAKE_BIN_SUFFIX\")
     _qt5_DBus_check_file_exists(${imported_location})
 
     set_target_properties(Qt5::qdbusxml2cpp PROPERTIES
diff --git a/src/gui/Qt5GuiConfigExtras.cmake.in b/src/gui/Qt5GuiConfigExtras.cmake.in
index 07869efd7d..37b95d1b6b 100644
--- a/src/gui/Qt5GuiConfigExtras.cmake.in
+++ b/src/gui/Qt5GuiConfigExtras.cmake.in
@@ -2,7 +2,7 @@
 !!IF !isEmpty(CMAKE_ANGLE_EGL_DLL_RELEASE)
 
 !!IF isEmpty(CMAKE_INCLUDE_DIR_IS_ABSOLUTE)
-set(Qt5Gui_EGL_INCLUDE_DIRS \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$$CMAKE_INCLUDE_DIR/QtANGLE\")
+set(Qt5Gui_EGL_INCLUDE_DIRS \"$$NIX_OUTPUT_DEV/$$CMAKE_INCLUDE_DIR/QtANGLE\")
 !!ELSE
 set(Qt5Gui_EGL_INCLUDE_DIRS \"$$CMAKE_INCLUDE_DIR/QtANGLE\")
 !!ENDIF
@@ -17,13 +17,13 @@ macro(_populate_qt5gui_gl_target_properties TargetName Configuration LIB_LOCATIO
     set_property(TARGET Qt5::${TargetName} APPEND PROPERTY IMPORTED_CONFIGURATIONS ${Configuration})
 
 !!IF isEmpty(CMAKE_DLL_DIR_IS_ABSOLUTE)
-    set(imported_location \"${_qt5Gui_install_prefix}/$${CMAKE_DLL_DIR}${LIB_LOCATION}\")
+    set(imported_location \"$$NIX_OUTPUT_OUT/$${CMAKE_DLL_DIR}${LIB_LOCATION}\")
 !!ELSE
     set(imported_location \"$${CMAKE_DLL_DIR}${LIB_LOCATION}\")
 !!ENDIF
 
 !!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
-    set(imported_implib \"${_qt5Gui_install_prefix}/$${CMAKE_LIB_DIR}${IMPLIB_LOCATION}\")
+    set(imported_implib \"$$NIX_OUTPUT_DEV/$${CMAKE_LIB_DIR}${IMPLIB_LOCATION}\")
 !!ELSE
     set(imported_implib \"$${CMAKE_LIB_DIR}${IMPLIB_LOCATION}\")
 !!ENDIF
diff --git a/src/network/kernel/qdnslookup_unix.cpp b/src/network/kernel/qdnslookup_unix.cpp
index 584f0b0f0e..24d80063f2 100644
--- a/src/network/kernel/qdnslookup_unix.cpp
+++ b/src/network/kernel/qdnslookup_unix.cpp
@@ -83,7 +83,7 @@ static bool resolveLibraryInternal()
     if (!lib.load())
 #endif
     {
-        lib.setFileName(QLatin1String("resolv"));
+        lib.setFileName(QLatin1String(NIXPKGS_LIBRESOLV));
         if (!lib.load())
             return false;
     }
diff --git a/src/network/kernel/qhostinfo_unix.cpp b/src/network/kernel/qhostinfo_unix.cpp
index dabf1913cc..53bb867e07 100644
--- a/src/network/kernel/qhostinfo_unix.cpp
+++ b/src/network/kernel/qhostinfo_unix.cpp
@@ -94,7 +94,7 @@ static bool resolveLibraryInternal()
     if (!lib.load())
 #endif
     {
-        lib.setFileName(QLatin1String("resolv"));
+        lib.setFileName(QLatin1String(NIXPKGS_LIBRESOLV));
         if (!lib.load())
             return false;
     }
diff --git a/src/network/ssl/qsslcontext_openssl.cpp b/src/network/ssl/qsslcontext_openssl.cpp
index 68caaeb6dc..fef4a81474 100644
--- a/src/network/ssl/qsslcontext_openssl.cpp
+++ b/src/network/ssl/qsslcontext_openssl.cpp
@@ -340,7 +340,7 @@ init_context:
 
     const QVector<QSslEllipticCurve> qcurves = sslContext->sslConfiguration.ellipticCurves();
     if (!qcurves.isEmpty()) {
-#if OPENSSL_VERSION_NUMBER >= 0x10002000L && !defined(OPENSSL_NO_EC)
+#if OPENSSL_VERSION_NUMBER >= 0x10002000L && defined(SSL_CTRL_SET_CURVES) && !defined(OPENSSL_NO_EC)
         // Set the curves to be used
         if (q_SSLeay() >= 0x10002000L) {
             // SSL_CTX_ctrl wants a non-const pointer as last argument,
@@ -354,7 +354,7 @@ init_context:
                 return sslContext;
             }
         } else
-#endif // OPENSSL_VERSION_NUMBER >= 0x10002000L && !defined(OPENSSL_NO_EC)
+#endif // OPENSSL_VERSION_NUMBER >= 0x10002000L && defined(SSL_CTRL_SET_CURVES) && !defined(OPENSSL_NO_EC)
         {
             // specific curves requested, but not possible to set -> error
             sslContext->errorStr = msgErrorSettingEllipticCurves(QSslSocket::tr("OpenSSL version too old, need at least v1.0.2"));
diff --git a/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp b/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp
index 44f1d7e6ba..e24fe54326 100644
--- a/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp
+++ b/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp
@@ -251,12 +251,9 @@ void TableGenerator::initPossibleLocations()
     // the QTCOMPOSE environment variable
     if (qEnvironmentVariableIsSet("QTCOMPOSE"))
         m_possibleLocations.append(QString::fromLocal8Bit(qgetenv("QTCOMPOSE")));
-    m_possibleLocations.append(QStringLiteral("/usr/share/X11/locale"));
-    m_possibleLocations.append(QStringLiteral("/usr/local/share/X11/locale"));
-    m_possibleLocations.append(QStringLiteral("/usr/lib/X11/locale"));
-    m_possibleLocations.append(QStringLiteral("/usr/local/lib/X11/locale"));
     m_possibleLocations.append(QStringLiteral(X11_PREFIX "/share/X11/locale"));
     m_possibleLocations.append(QStringLiteral(X11_PREFIX "/lib/X11/locale"));
+    m_possibleLocations.append(QLatin1String(NIXPKGS_QTCOMPOSE));
 }
 
 QString TableGenerator::findComposeFile()
diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp
index 9bdedcc830..2559b2066b 100644
--- a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp
+++ b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp
@@ -570,7 +570,14 @@ void (*QGLXContext::getProcAddress(const QByteArray &procName)) ()
 #ifndef QT_NO_LIBRARY
                 extern const QString qt_gl_library_name();
 //                QLibrary lib(qt_gl_library_name());
+                // Check system library paths first
                 QLibrary lib(QLatin1String("GL"));
+#ifdef NIXPKGS_MESA_GL
+                if (!lib.load()) {
+                    // Fallback to Mesa driver
+                    lib.setFileName(QLatin1String(NIXPKGS_MESA_GL));
+                }
+#endif // NIXPKGS_MESA_GL
                 glXGetProcAddressARB = (qt_glXGetProcAddressARB) lib.resolve("glXGetProcAddressARB");
 #endif
             }
diff --git a/src/plugins/platforms/xcb/qxcbcursor.cpp b/src/plugins/platforms/xcb/qxcbcursor.cpp
index b321ed95dc..9e7a72521c 100644
--- a/src/plugins/platforms/xcb/qxcbcursor.cpp
+++ b/src/plugins/platforms/xcb/qxcbcursor.cpp
@@ -303,10 +303,10 @@ QXcbCursor::QXcbCursor(QXcbConnection *conn, QXcbScreen *screen)
 #if defined(XCB_USE_XLIB) && !defined(QT_NO_LIBRARY)
     static bool function_ptrs_not_initialized = true;
     if (function_ptrs_not_initialized) {
-        QLibrary xcursorLib(QLatin1String("Xcursor"), 1);
+        QLibrary xcursorLib(QLatin1String(NIXPKGS_LIBXCURSOR), 1);
         bool xcursorFound = xcursorLib.load();
         if (!xcursorFound) { // try without the version number
-            xcursorLib.setFileName(QLatin1String("Xcursor"));
+            xcursorLib.setFileName(QLatin1String(NIXPKGS_LIBXCURSOR));
             xcursorFound = xcursorLib.load();
         }
         if (xcursorFound) {
diff --git a/src/widgets/Qt5WidgetsConfigExtras.cmake.in b/src/widgets/Qt5WidgetsConfigExtras.cmake.in
index 99d87e2e46..a4eab2aa72 100644
--- a/src/widgets/Qt5WidgetsConfigExtras.cmake.in
+++ b/src/widgets/Qt5WidgetsConfigExtras.cmake.in
@@ -3,7 +3,7 @@ if (NOT TARGET Qt5::uic)
     add_executable(Qt5::uic IMPORTED)
 
 !!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE)
-    set(imported_location \"${_qt5Widgets_install_prefix}/$${CMAKE_BIN_DIR}uic$$CMAKE_BIN_SUFFIX\")
+    set(imported_location \"$$NIX_OUTPUT_DEV/$${CMAKE_BIN_DIR}uic$$CMAKE_BIN_SUFFIX\")
 !!ELSE
     set(imported_location \"$${CMAKE_BIN_DIR}uic$$CMAKE_BIN_SUFFIX\")
 !!ENDIF