mirror of
https://github.com/nix-community/home-manager
synced 2024-12-25 19:29:47 +01:00
qt: export QT_PLUGIN_PATH/QML2_IMPORT_PATH
Those 2 variables are necessary to make e.g.: qt6ct work correctly. See issue: https://github.com/NixOS/nixpkgs/issues/239909.
This commit is contained in:
parent
c7ac0e0d36
commit
2e44116afc
3 changed files with 22 additions and 2 deletions
|
@ -127,7 +127,10 @@ in {
|
||||||
config = let
|
config = let
|
||||||
|
|
||||||
# Necessary because home.sessionVariables doesn't support mkIf
|
# Necessary because home.sessionVariables doesn't support mkIf
|
||||||
envVars = filterAttrs (n: v: v != null) {
|
envVars = let
|
||||||
|
inherit (config.home) profileDirectory;
|
||||||
|
qtVersions = with pkgs; [ qt5 qt6 ];
|
||||||
|
in filterAttrs (n: v: v != null) {
|
||||||
QT_QPA_PLATFORMTHEME = if cfg.platformTheme == "gtk" then
|
QT_QPA_PLATFORMTHEME = if cfg.platformTheme == "gtk" then
|
||||||
"gtk2"
|
"gtk2"
|
||||||
else if cfg.platformTheme == "qtct" then
|
else if cfg.platformTheme == "qtct" then
|
||||||
|
@ -135,6 +138,14 @@ in {
|
||||||
else
|
else
|
||||||
cfg.platformTheme;
|
cfg.platformTheme;
|
||||||
QT_STYLE_OVERRIDE = cfg.style.name;
|
QT_STYLE_OVERRIDE = cfg.style.name;
|
||||||
|
QT_PLUGIN_PATH = "$QT_PLUGIN_PATH\${QT_PLUGIN_PATH:+:}"
|
||||||
|
+ (lib.concatStringsSep ":"
|
||||||
|
(map (qt: "${profileDirectory}/${qt.qtbase.qtPluginPrefix}")
|
||||||
|
qtVersions));
|
||||||
|
QML2_IMPORT_PATH = "$QML2_IMPORT_PATH\${QML2_IMPORT_PATH:+:}"
|
||||||
|
+ (lib.concatStringsSep ":"
|
||||||
|
(map (qt: "${profileDirectory}/${qt.qtbase.qtQmlPrefix}")
|
||||||
|
qtVersions));
|
||||||
};
|
};
|
||||||
|
|
||||||
in mkIf (cfg.enable && cfg.platformTheme != null) {
|
in mkIf (cfg.enable && cfg.platformTheme != null) {
|
||||||
|
@ -168,7 +179,8 @@ in {
|
||||||
++ lib.optionals (cfg.style.package != null)
|
++ lib.optionals (cfg.style.package != null)
|
||||||
(lib.toList cfg.style.package);
|
(lib.toList cfg.style.package);
|
||||||
|
|
||||||
xsession.importedVariables = [ "QT_QPA_PLATFORMTHEME" ]
|
xsession.importedVariables =
|
||||||
|
[ "QT_QPA_PLATFORMTHEME" "QT_PLUGIN_PATH" "QML2_IMPORT_PATH" ]
|
||||||
++ lib.optionals (cfg.style.name != null) [ "QT_STYLE_OVERRIDE" ];
|
++ lib.optionals (cfg.style.name != null) [ "QT_STYLE_OVERRIDE" ];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,10 @@
|
||||||
'QT_QPA_PLATFORMTHEME="gnome"'
|
'QT_QPA_PLATFORMTHEME="gnome"'
|
||||||
assertFileRegex home-path/etc/profile.d/hm-session-vars.sh \
|
assertFileRegex home-path/etc/profile.d/hm-session-vars.sh \
|
||||||
'QT_STYLE_OVERRIDE="adwaita"'
|
'QT_STYLE_OVERRIDE="adwaita"'
|
||||||
|
assertFileRegex home-path/etc/profile.d/hm-session-vars.sh \
|
||||||
|
'QT_PLUGIN_PATH'
|
||||||
|
assertFileRegex home-path/etc/profile.d/hm-session-vars.sh \
|
||||||
|
'QML2_IMPORT_PATH'
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,10 @@
|
||||||
nmt.script = ''
|
nmt.script = ''
|
||||||
assertFileRegex home-path/etc/profile.d/hm-session-vars.sh \
|
assertFileRegex home-path/etc/profile.d/hm-session-vars.sh \
|
||||||
'QT_QPA_PLATFORMTHEME="gtk2"'
|
'QT_QPA_PLATFORMTHEME="gtk2"'
|
||||||
|
assertFileRegex home-path/etc/profile.d/hm-session-vars.sh \
|
||||||
|
'QT_PLUGIN_PATH'
|
||||||
|
assertFileRegex home-path/etc/profile.d/hm-session-vars.sh \
|
||||||
|
'QML2_IMPORT_PATH'
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue