diff --git a/modules/misc/qt.nix b/modules/misc/qt.nix index f02bc186..18a90cb8 100644 --- a/modules/misc/qt.nix +++ b/modules/misc/qt.nix @@ -170,13 +170,10 @@ in { inherit (config.home) profileDirectory; qtVersions = with pkgs; [ qt5 qt6 ]; makeQtPath = prefix: - lib.concatStringsSep ":" (map (qt: "${profileDirectory}/${qt.qtbase.${prefix}}") qtVersions); in { - QT_PLUGIN_PATH = "$QT_PLUGIN_PATH\${QT_PLUGIN_PATH:+:}" - + (makeQtPath "qtPluginPrefix"); - QML2_IMPORT_PATH = "$QML2_IMPORT_PATH\${QML2_IMPORT_PATH:+:}" - + (makeQtPath "qtQmlPrefix"); + QT_PLUGIN_PATH = makeQtPath "qtPluginPrefix"; + QML2_IMPORT_PATH = makeQtPath "qtQmlPrefix"; }; in lib.mkIf cfg.enable { @@ -194,19 +191,14 @@ in { home = { sessionVariables = envVars; - # home.sessionVariables does not support setting the same environment - # variable to different values. - # Since some other modules may set the QT_PLUGIN_PATH or QML2_IMPORT_PATH - # to their own value, e.g.: fcitx5, we avoid conflicts by setting - # the values in home.sessionVariablesExtra instead. - sessionVariablesExtra = '' - export QT_PLUGIN_PATH=${envVarsExtra.QT_PLUGIN_PATH} - export QML2_IMPORT_PATH=${envVarsExtra.QML2_IMPORT_PATH} - ''; + sessionSearchVariables = envVarsExtra; }; # Apply theming also to apps started by systemd. - systemd.user.sessionVariables = envVars // envVarsExtra; + systemd.user.sessionVariables = envVars // { + QT_PLUGIN_PATH = lib.concatStringsSep ":" envVarsExtra.QT_PLUGIN_PATH; + QML2_IMPORT_PATH = lib.concatStringsSep ":" envVarsExtra.QML2_IMPORT_PATH; + }; home.packages = (lib.optionals (cfg.platformTheme != null) platformPackages.${cfg.platformTheme} or [ ]) diff --git a/tests/modules/misc/qt/qt-platform-theme-gtk.nix b/tests/modules/misc/qt/qt-platform-theme-gtk.nix index 070c8020..b91496b5 100644 --- a/tests/modules/misc/qt/qt-platform-theme-gtk.nix +++ b/tests/modules/misc/qt/qt-platform-theme-gtk.nix @@ -6,7 +6,6 @@ enable = true; platformTheme = "gtk"; }; - i18n.inputMethod.enabled = "fcitx5"; nmt.script = '' assertFileRegex home-path/etc/profile.d/hm-session-vars.sh \