Commit 68cc0258 authored by K900's avatar K900
Browse files

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.
parent c1460d70
Loading
Loading
Loading
Loading
+11 −1
Original line number Diff line number Diff line
@@ -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
+3 −0
Original line number Diff line number Diff line
@@ -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"
    ]
  );

+1 −1
Original line number Diff line number Diff line
@@ -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;
}
+2 −1
Original line number Diff line number Diff line
@@ -2,5 +2,6 @@

qtModule {
  pname = "qttranslations";
  qtInputs = [ qttools ];
  nativeBuildInputs = [ qttools ];
  outputs = [ "out" ];
}
+1 −1
Original line number Diff line number Diff line
@@ -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;