Help setting some boring dark theme

I’m using NixOS with home-manager without any desktop environment, just niri wm and need to set some simple dark theme which works across all applications.

I’ve done kernel driver development and os image building with / on tmpfs for embedded devices with Nix and other crazy things but nothing proved to be harder for me than setting a simple dark theme which would work across majority of GUI applications. I’ve been more or less ignoring this problem for many years because every time I tried to solve it I failed but it’s been constantly bugging me every day. Now it’s time to ask for help.

Right now I have:

  gtk = {
    enable = true;
    theme = {
      name = "Adwaita-dark";
      package = pkgs.gnome-themes-extra;
    };
    gtk3.extraConfig.gtk-application-prefer-dark-theme = 1;
    gtk4.extraConfig.gtk-application-prefer-dark-theme = 1;
  };

  qt = {
    enable = true;
    style = {
      name = "adwaita-dark";
    };
  };

in my home settings with following results:

  • VSCodium is dark
  • Okular is light but with random dark ui elements!
  • gnome-disks (executed as user, I’m well aware that sudo without additional settings/params like doesn’t preserve env) is completely light threatening to blind me.

What is the most simple and the most non-hacky way (do one really need to play with dconf like some google search results suggest?) short of going all out and using Stylix? Thanks.

1 Like

For GTK4/libadwaita apps, yes. There’s the dconf.settings gadget in Home Manager, and you can use that to set "org/gnome/desktop/interface".color-scheme = "prefer-dark".

For this I can highly recommend stylix: GitHub - danth/stylix: Theming framework for NixOS, Home Manager, nix-darwin, and Nix-on-Droid

I don’t use HM at all, and use the NixOS dconf module instead.

  programs.dconf.profiles.user.databases = [{
    settings."org/gnome/desktop/interface".color-scheme = "prefer-dark";
  }];

If you want user-specific config, then use the HM solution as mentioned above.

Okular uses qt, you need to somehow theme that separately. I’ve never been successful with declaratively setting qt theming, but I do have

  environment.sessionVariables = {
    QT_QPA_PLATFORMTHEME = "qt6ct";
    QT_STYLE_OVERRIDE = "kvantum";
  };

along with pkgs.qt6Packages qt6ct and pkgs.qt6Packages.qtstyleplugin-kvantum in the package list, then use kvantum to set the theme directly.
You may have to double-check if HM has some module that does that already and use that.

I have removed both home.gtk and home.qt and set just this ^ and it somehow works! I have checked my ~ and ~/.config/ for anything obviously related to GTK or QT and except for some bookmarks in GTK and recent files in QT filepicker I haven’t found anything. So the dconf entry is driving it all! And it all works still after reboot it wasn’t just some weird state.

I use less than a dozen GUI apps and ones which I’ve managed to try are nice dark even Okular.