1{
2 qtModule,
3 qtbase,
4 qtlanguageserver,
5 qtshadertools,
6 qtsvg,
7 openssl,
8 darwin,
9 stdenv,
10 lib,
11 pkgsBuildBuild,
12 replaceVars,
13 fetchpatch,
14}:
15
16qtModule {
17 pname = "qtdeclarative";
18
19 propagatedBuildInputs = [
20 qtbase
21 qtlanguageserver
22 qtshadertools
23 qtsvg
24 openssl
25 ];
26 strictDeps = true;
27
28 nativeBuildInputs = lib.optionals stdenv.hostPlatform.isDarwin [
29 darwin.sigtool
30 ];
31
32 patches = [
33 # invalidates qml caches created from nix applications at different
34 # store paths and disallows saving caches of bare qml files in the store.
35 (replaceVars ./invalidate-caches-from-mismatched-store-paths.patch {
36 nixStore = builtins.storeDir;
37 nixStoreLength = builtins.toString ((builtins.stringLength builtins.storeDir) + 1); # trailing /
38 })
39 # add version specific QML import path
40 ./use-versioned-import-path.patch
41 # This should make it into the 6.9.2 release.
42 (fetchpatch {
43 url = "https://invent.kde.org/qt/qt/qtdeclarative/-/commit/672e6777e8e6a8fd.diff";
44 hash = "sha256-nPczX6SHZPcdg7AqpRIwPCrcS3PId+Ibb0iPSiHUdaw=";
45 })
46 ];
47
48 preConfigure =
49 let
50 storePrefixLen = builtins.toString ((builtins.stringLength builtins.storeDir) + 1);
51 in
52 ''
53 # "NIX:" is reserved for saved qmlc files in patch 0001, "QTDHASH:" takes the place
54 # of the old tag, which is otherwise the qt version, invalidating caches from other
55 # qtdeclarative store paths.
56 echo "QTDHASH:''${out:${storePrefixLen}:32}" > .tag
57 '';
58
59 cmakeFlags = [
60 "-DQt6ShaderToolsTools_DIR=${pkgsBuildBuild.qt6.qtshadertools}/lib/cmake/Qt6ShaderTools"
61 # for some reason doesn't get found automatically on Darwin
62 "-DPython_EXECUTABLE=${lib.getExe pkgsBuildBuild.python3}"
63 ]
64 # Conditional is required to prevent infinite recursion during a cross build
65 ++ lib.optionals (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) [
66 "-DQt6QmlTools_DIR=${pkgsBuildBuild.qt6.qtdeclarative}/lib/cmake/Qt6QmlTools"
67 ];
68
69 meta.maintainers = with lib.maintainers; [
70 nickcao
71 outfoxxed
72 ];
73}