Sample Header Ad - 728x90

How to properly set QT_STYLE_OVERRIDE env var in GNOME on NixOS?

0 votes
1 answer
3085 views
I have a question about theming for Qt apps on Gnome. I'm running NixOS with Gnome, using Home Manager and Flakes. My theme is Adwaita-dark, but I've noticed that some Qt apps such as VLC do not have a dark theme applied. I tried tweaking all qt related settings in home.nix, but it didn't work. I got a clue to what the issue was when I ran qt5ct and it showed this message:
Please remove the QT_STYLE_OVERRIDE environment variable (current value: adwaita).

The QT_QPA_PLATFORMTHEME environment variable is not set correctly (current value: gnome, required value: qt5ct).
I finally found a workaround by adding the following to configuration.nix:
environment.variables = {
    "QT_STYLE_OVERRIDE" = pkgs.lib.mkForce "adwaita-dark";
  };
And now it works, Qt apps have the dark theme. However, this feels like a messy hack and I'd like to understand how to do it properly, if possible. Has anyone dealt with this before?
Asked by user22311319 (1 rep)
Jul 30, 2023, 11:23 PM
Last activity: May 18, 2025, 01:03 PM