summary refs log tree commit diff
diff options
context:
space:
mode:
authorK900 <me@0upti.me>2023-07-29 13:10:16 +0300
committerK900 <me@0upti.me>2023-08-15 22:11:10 +0300
commit68cc02588d4659c77b9e5bfab7ff848c2b5248ca (patch)
tree19b3fe34e50ca848cc1f71847f28f4a8e4a70223
parentc1460d70aa01ff4fd595b3efb195ca5975a13de0 (diff)
downloadnixpkgs-68cc02588d4659c77b9e5bfab7ff848c2b5248ca.tar
nixpkgs-68cc02588d4659c77b9e5bfab7ff848c2b5248ca.tar.gz
nixpkgs-68cc02588d4659c77b9e5bfab7ff848c2b5248ca.tar.bz2
nixpkgs-68cc02588d4659c77b9e5bfab7ff848c2b5248ca.tar.lz
nixpkgs-68cc02588d4659c77b9e5bfab7ff848c2b5248ca.tar.xz
nixpkgs-68cc02588d4659c77b9e5bfab7ff848c2b5248ca.tar.zst
nixpkgs-68cc02588d4659c77b9e5bfab7ff848c2b5248ca.zip
qt5: include qttranslations properly
Qt loads its own translations from a hardcoded path, and those are used
(among other things) for determining RTL layout preferences in applications,
so they are definitely something we want to have.

This adds a qtbase/qttools rebuild to the chain, but it's fast enough that it's
probably fine.

Another approach would be to load translation paths from the environment,
and inject it in wrapQtAppsHook, but that seems like more complexity
for very questionable build time savings.
-rw-r--r--pkgs/development/libraries/qt-5/5.15/default.nix12
-rw-r--r--pkgs/development/libraries/qt-5/modules/qtbase.nix3
-rw-r--r--pkgs/development/libraries/qt-5/modules/qttools.nix2
-rw-r--r--pkgs/development/libraries/qt-5/modules/qttranslations.nix3
-rw-r--r--pkgs/development/libraries/qt-5/qtModule.nix2
5 files changed, 18 insertions, 4 deletions
diff --git a/pkgs/development/libraries/qt-5/5.15/default.nix b/pkgs/development/libraries/qt-5/5.15/default.nix
index 5ae5102abee..ac4614d2aee 100644
--- a/pkgs/development/libraries/qt-5/5.15/default.nix
+++ b/pkgs/development/libraries/qt-5/5.15/default.nix
@@ -331,4 +331,14 @@ let
       } ../hooks/wrap-qt-apps-hook.sh;
     };
 
-in makeScopeWithSplicing (generateSplicesForMkScope "qt5") (_: {}) (_: {}) addPackages
+  baseScope = makeScopeWithSplicing (generateSplicesForMkScope "qt5") (_: {}) (_: {}) addPackages;
+
+  bootstrapScope = baseScope.overrideScope(final: prev: {
+    qtbase = prev.qtbase.override { qttranslations = null; };
+    qtdeclarative = null;
+  });
+
+  finalScope = baseScope.overrideScope(final: prev: {
+    qttranslations = bootstrapScope.qttranslations;
+  });
+in finalScope
diff --git a/pkgs/development/libraries/qt-5/modules/qtbase.nix b/pkgs/development/libraries/qt-5/modules/qtbase.nix
index de73bcbe277..9f0feaf94e5 100644
--- a/pkgs/development/libraries/qt-5/modules/qtbase.nix
+++ b/pkgs/development/libraries/qt-5/modules/qtbase.nix
@@ -15,6 +15,7 @@
   # optional dependencies
 , cups ? null, postgresql ? null
 , withGtk3 ? false, dconf, gtk3
+, qttranslations ? null
 
   # options
 , libGLSupported ? !stdenv.isDarwin
@@ -310,6 +311,8 @@ stdenv.mkDerivation (finalAttrs: {
     ] ++ lib.optionals (mysqlSupport) [
       "-L" "${libmysqlclient}/lib"
       "-I" "${libmysqlclient}/include"
+    ] ++ lib.optional (qttranslations != null) [
+      "-translationdir" "${qttranslations}/translations"
     ]
   );
 
diff --git a/pkgs/development/libraries/qt-5/modules/qttools.nix b/pkgs/development/libraries/qt-5/modules/qttools.nix
index be96236d728..bac70d146bf 100644
--- a/pkgs/development/libraries/qt-5/modules/qttools.nix
+++ b/pkgs/development/libraries/qt-5/modules/qttools.nix
@@ -36,7 +36,7 @@ qtModule {
     "bin/macdeployqt"
   ];
 
-  env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.isDarwin ''-DNIXPKGS_QMLIMPORTSCANNER="${qtdeclarative.dev}/bin/qmlimportscanner"'';
+  env.NIX_CFLAGS_COMPILE = lib.optionalString (stdenv.isDarwin && qtdeclarative != null) ''-DNIXPKGS_QMLIMPORTSCANNER="${qtdeclarative.dev}/bin/qmlimportscanner"'';
 
   setupHook = ../hooks/qttools-setup-hook.sh;
 }
diff --git a/pkgs/development/libraries/qt-5/modules/qttranslations.nix b/pkgs/development/libraries/qt-5/modules/qttranslations.nix
index f49a4eb9a85..bcd52cdc4a8 100644
--- a/pkgs/development/libraries/qt-5/modules/qttranslations.nix
+++ b/pkgs/development/libraries/qt-5/modules/qttranslations.nix
@@ -2,5 +2,6 @@
 
 qtModule {
   pname = "qttranslations";
-  qtInputs = [ qttools ];
+  nativeBuildInputs = [ qttools ];
+  outputs = [ "out" ];
 }
diff --git a/pkgs/development/libraries/qt-5/qtModule.nix b/pkgs/development/libraries/qt-5/qtModule.nix
index 9abd9fabc95..bddbf254c5f 100644
--- a/pkgs/development/libraries/qt-5/qtModule.nix
+++ b/pkgs/development/libraries/qt-5/qtModule.nix
@@ -17,7 +17,7 @@ mkDerivation (args // {
   patches = (args.patches or []) ++ (patches.${pname} or []);
 
   nativeBuildInputs = (args.nativeBuildInputs or []) ++ [ perl self.qmake ];
-  propagatedBuildInputs = args.qtInputs ++ (args.propagatedBuildInputs or []);
+  propagatedBuildInputs = (args.qtInputs or []) ++ (args.propagatedBuildInputs or []);
 
   outputs = args.outputs or [ "out" "dev" ];
   setOutputFlags = args.setOutputFlags or false;