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