Skip to content

Instantly share code, notes, and snippets.

@NickCao
Created November 22, 2022 05:40
Show Gist options
  • Save NickCao/73d817890229f24986ae030045be4351 to your computer and use it in GitHub Desktop.
Save NickCao/73d817890229f24986ae030045be4351 to your computer and use it in GitHub Desktop.
qt.patch
diff --git a/pkgs/applications/misc/gpxsee/default.nix b/pkgs/applications/misc/gpxsee/default.nix
index b9a357cd02d..60b8213e333 100644
--- a/pkgs/applications/misc/gpxsee/default.nix
+++ b/pkgs/applications/misc/gpxsee/default.nix
@@ -48,8 +48,7 @@ stdenv.mkDerivation rec {
nativeBuildInputs = [ qmake qttools wrapQtAppsHook ];
- # NOTE: translations are only working with the qt5 build, so qt6 is English only for now
- preConfigure = lib.optionalString isQt5 ''
+ preConfigure =''
lrelease gpxsee.pro
'';
diff --git a/pkgs/development/libraries/qt-6/modules/qttools.nix b/pkgs/development/libraries/qt-6/modules/qttools.nix
index b1cf5dd2c14..06ce64424d5 100644
--- a/pkgs/development/libraries/qt-6/modules/qttools.nix
+++ b/pkgs/development/libraries/qt-6/modules/qttools.nix
@@ -3,9 +3,16 @@
, lib
, qtbase
, qtdeclarative
+, substituteAll
}:
qtModule {
pname = "qttools";
qtInputs = [ qtbase qtdeclarative ];
+ patches = [
+ ../patches/qttools-paths.patch
+ ];
+ NIX_CFLAGS_COMPILE = [
+ "-DNIX_OUTPUT_DEV=\"${placeholder "dev"}\""
+ ];
}
diff --git a/pkgs/development/libraries/qt-6/patches/qttools-paths.patch b/pkgs/development/libraries/qt-6/patches/qttools-paths.patch
new file mode 100644
index 00000000000..625ee4253a6
--- /dev/null
+++ b/pkgs/development/libraries/qt-6/patches/qttools-paths.patch
@@ -0,0 +1,27 @@
+diff --git a/src/linguist/shared/runqttool.cpp b/src/linguist/shared/runqttool.cpp
+index d355b9dc..94fef33f 100644
+--- a/src/linguist/shared/runqttool.cpp
++++ b/src/linguist/shared/runqttool.cpp
+@@ -20,9 +20,21 @@ class FMT {
+ Q_DECLARE_TR_FUNCTIONS(Linguist)
+ };
+
++static QString qtBasePath(QLibraryInfo::LibraryPath location)
++{
++ switch (location) {
++ case QLibraryInfo::BinariesPath:
++ return QLatin1String(NIX_OUTPUT_DEV) + QLatin1String("/bin");
++ case QLibraryInfo::LibraryExecutablesPath:
++ return QLatin1String(NIX_OUTPUT_DEV) + QLatin1String("/libexec");
++ default:
++ return QLibraryInfo::path(location);
++ }
++}
++
+ static QString qtToolFilePath(const QString &toolName, QLibraryInfo::LibraryPath location)
+ {
+- QString filePath = QLibraryInfo::path(location) + QLatin1Char('/') + toolName;
++ QString filePath = qtBasePath(location) + QLatin1Char('/') + toolName;
+ #ifdef Q_OS_WIN
+ filePath.append(QLatin1String(".exe"));
+ #endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment