1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-23 03:29:45 +01:00

qt: use home.sessionSearchVariables

This commit is contained in:
Thiago Kenji Okada 2023-11-21 18:59:20 +00:00
parent 0b25ac41ee
commit dbc1ebb0eb
2 changed files with 7 additions and 16 deletions

View file

@ -170,13 +170,10 @@ in {
inherit (config.home) profileDirectory; inherit (config.home) profileDirectory;
qtVersions = with pkgs; [ qt5 qt6 ]; qtVersions = with pkgs; [ qt5 qt6 ];
makeQtPath = prefix: makeQtPath = prefix:
lib.concatStringsSep ":"
(map (qt: "${profileDirectory}/${qt.qtbase.${prefix}}") qtVersions); (map (qt: "${profileDirectory}/${qt.qtbase.${prefix}}") qtVersions);
in { in {
QT_PLUGIN_PATH = "$QT_PLUGIN_PATH\${QT_PLUGIN_PATH:+:}" QT_PLUGIN_PATH = makeQtPath "qtPluginPrefix";
+ (makeQtPath "qtPluginPrefix"); QML2_IMPORT_PATH = makeQtPath "qtQmlPrefix";
QML2_IMPORT_PATH = "$QML2_IMPORT_PATH\${QML2_IMPORT_PATH:+:}"
+ (makeQtPath "qtQmlPrefix");
}; };
in lib.mkIf cfg.enable { in lib.mkIf cfg.enable {
@ -194,19 +191,14 @@ in {
home = { home = {
sessionVariables = envVars; sessionVariables = envVars;
# home.sessionVariables does not support setting the same environment sessionSearchVariables = envVarsExtra;
# 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}
'';
}; };
# Apply theming also to apps started by systemd. # 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) home.packages = (lib.optionals (cfg.platformTheme != null)
platformPackages.${cfg.platformTheme} or [ ]) platformPackages.${cfg.platformTheme} or [ ])

View file

@ -6,7 +6,6 @@
enable = true; enable = true;
platformTheme = "gtk"; platformTheme = "gtk";
}; };
i18n.inputMethod.enabled = "fcitx5";
nmt.script = '' nmt.script = ''
assertFileRegex home-path/etc/profile.d/hm-session-vars.sh \ assertFileRegex home-path/etc/profile.d/hm-session-vars.sh \