Hey fellow Nix enthusiasts!
If you are venturing into the beautiful world of Nix and want to spruce up your Qt applications with a theme, here is a simple guide to get you started:
System Configuration
environment.systemPackages = with pkgs;
[
libsForQt5.qtstyleplugin-kvantum
libsForQt5.qt5ct
];
nixpkgs.config.qt5 = {
enable = true;
platformTheme = "qt5ct";
style = {
package = pkgs.utterly-nord-plasma;
name = "Utterly Nord Plasma";
};
};
environment.variables.QT_QPA_PLATFORMTHEME = "qt5ct";
This snippet ensures your system knows about the qt6ct or qt5ct or Kvantum platform theme and qt6ct or qt5ct or Kvantum, a tool to apply stunning themes to Qt applications.
Home Manager Configuration
In your home.nix, you might want to fetch a fresh theme from the unstable channel and get access to theme directly :
home-manager.users.varmisa = { pkgs, ... }: let
unstablePkgs = import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/nixos-unstable.tar.gz") {
config = config.nixpkgs.config;
};
in {
home.packages = with pkgs; [unstablePkgs.utterly-nord-plasma];
xdg.configFile = {
"Kvantum/Utterly-Nord-Solid-Plasma/Utterly-Nord-Solid/Utterly-Nord-Solid.kvconfig".source = "${unstablePkgs.utterly-nord-plasma}/share/Kvantum/Utterly-Nord-Solid/Utterly-Nord-Solid.kvconfig";
"Kvantum/Utterly-Nord-Solid-Plasma/Utterly-Nord-Solid/Utterly-Nord-Solid.svg".source = "${unstablePkgs.utterly-nord-plasma}/share/Kvantum/Utterly-Nord-Solid/Utterly-Nord-Solid.svg";
"Kvantum/Utterly-Nord-Solid-Plasma/Utterly-Nord-Solid/Nord.patchconfig".source = "${unstablePkgs.utterly-nord-plasma}/share/Kvantum/Utterly-Nord-Solid/Nord.patchconfig";
"Kvantum/kvantum.kvconfig".text = "[General]\ntheme=Utterly-Nord-Solid";
};
What’s happening here?
We’re telling our home environment to use a cool theme called ‘Utterly Nord Plasma’. By pointing to the unstable channel, we get the latest goodies. We also directly tell our system where to find the theme’s configuration files.
Finding Theme Files
Not sure where your theme’s files are? Run this magic spell in your terminal :
nix-store -q --requisites /nix/store/*-package-name*
Replace package-name
with the name of your theme package. This command will reveal all the paths related to your theme in the Nix store.
Hope this helps! Happy theming!
P.S. Quick note, friends! This guide assumes that you’re using a setup where Home Manager is integrated as part of your Nix system configuration. If you’re running Home Manager standalone, the steps will differ slightly. This setup is great for a cohesive environment where system and user configurations are harmoniously blended. Happy configuring!