Hello!
I am new to nixOS so bare with me as im probably missing something really small and dumb. I am trying to use Stylix in addition to pywal (possibly replacing pywal) to get automatic theming on my system. I have followed vimjoyer’s guide and added the following lines to my flake…
vimjoyer video title: Ricing Linux Has Never Been Easier
runtime: 6:18
{
description = "Nixos config flake";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
...
stylix.url = "github:danth/stylix";
};
outputs = { self, nixpkgs, home-manager, stylix, ... }@inputs: {
nixosConfigurations.home = nixpkgs.lib.nixosSystem {
specialArgs = {inherit inputs;};
modules = [
system/configuration.nix
inputs.stylix.nixosModules.stylix
inputs.home-manager.nixosModules.default
];
};
};
}
and then created a stylix.nix file which I import into my configuration.nix…
stylix.nix:
{ ... }:
{
stylix.enable = true;
stylix.image = wallpapers/nazghul-forest.png;
stylix.polarity = "dark";
stylix.targets.gtk.enable = true;
}
configuration.nix:
...
imports =
[
stylix/stylix.nix
./hardware-configuration.nix
...
];
...
According to vimjoyer, this is all I need, but his file browser was themed and mine is not. I tried nautilus
, xfce.nemo
, dolphin
, and thunar
. It also doesn’t apply to other gtk themes like the context menu for nmapplet, the blueman app or Remmina VNC app. Doesn’t seem to be theming any gtk apps.
Any help would be appreciated.
Wouldn’t you need to enable stylix as home-manager module as well? Otherwise I think the theming is user specific and not touched by a system wide rebuild?!
I updated my flake.nix to include a homeConfiguration…
{
description = "Nixos config flake";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
stylix.url = "github:danth/stylix";
...
};
outputs = { self, nixpkgs, home-manager, stylix, ... }@inputs: {
nixosConfigurations.home = nixpkgs.lib.nixosSystem {
specialArgs = {inherit inputs;};
modules = [
system/configuration.nix
# stylix.nixosModules.stylix
inputs.home-manager.nixosModules.default
];
};
homeConfigurations."<user>" = home-manager.lib.homeManagerConfiguration {
pkgs = nixpkgs.legacyPackages.x86_64-linux;
modules = [ stylix.homeManagerModules.stylix home/home.nix inputs.home-manager.nixosModules.default ];
};
};
}
And it builds but there is no change in GTK apps unfortunately…
I also tried removing stylix from my nixosConfiguration modules as you can see, and this results in an error "the option stylix doesn't exist"
So in my Flake I only defined stylix as following
in {
nixosConfigurations = {
nixos = lib.nixosSystem {
inherit system;
modules = [
./configuration.nix
sddm-sugar-candy-nix.nixosModules.default
inputs.stylix.nixosModules.stylix
{
environment.systemPackages = [
zen-browser.packages.x86_64-linux.zen-browser
];
}
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.extraSpecialArgs = specialArgs;
#home-manager.sharedModules = [ plasma-manager.homeManagerModules.plasma-manager ];
and Stylix is only setup in my config not home manager:
{
stylix = {
enable = true;
base16Scheme = "${pkgs.base16-schemes}/share/themes/onedark.yaml";
image = ../png/mountain.jpeg;
cursor.package = pkgs.simp1e-cursors;
cursor.name = "Simp1e-Adw-Dark";
cursor.size = 24;
targets.grub.enable = false;
targets.plymouth.enable = false;
fonts = {
monospace = {
package = pkgs.nerdfonts.override {fonts = ["JetBrainsMono"];};
name = "JetBrainsMono Nerd Font";
};
};
fonts.sizes = {
applications = 10;
terminal = 13;
desktop = 10;
popups = 10;
};
};
}
But if you are using Gnome you need to reboot or sign out so gtk changes.
I have replicated this to the best of my understanding and it succeeds in theming my terminal, the background color of my waybar, vscode and others but still not gtk apps. I have made sure to leave out some of your lines of code to ensure GTK isn’t blocked. I tried logging out and back in but there is still no change.
flake.nix:
{
description = "Nixos config flake";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
stylix.url = "github:danth/stylix";
};
outputs = { self, nixpkgs, home-manager, stylix, ... }@inputs: {
nixosConfigurations.home = nixpkgs.lib.nixosSystem {
specialArgs = {inherit inputs;};
modules = [
system/configuration.nix
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
}
inputs.stylix.nixosModules.stylix
];
};
};
}
configuration.nix:
stylix = {
enable = true;
polarity = "dark";
image = ../wallpapers/nazghul-forest.png;
cursor.size = 24;
targets.grub.enable = true;
targets.plymouth.enable = true;
fonts.sizes = {
applications = 10;
terminal = 13;
desktop = 10;
popups = 10;
};
};
I have no idea why it works on some things but doesn’t appear to work for any GUI applications. QT, GTK, none of the applet context menu’s, etc.
Maybe try to set QT Theming as following in the Home Manager:
{ config, pkgs, lib, inputs, ... }:
{
home.packages = with pkgs; [
gradience
];
gtk = {
enable = true;
theme = {
name = lib.mkForce "adw-gtk3-dark";
package = lib.mkForce pkgs.adw-gtk3;
};
iconTheme.package = pkgs.papirus-icon-theme;
iconTheme.name = "Papirus";
gtk3.extraConfig = {
Settings = ''
gtk-application-prefer-dark-theme=1
'';
};
gtk4.extraConfig = {
Settings = ''
gtk-application-prefer-dark-theme=1
'';
};
};
qt = {
enable = true;
platformTheme = "gnome";
style.name = "adwaita-dark";
style.package = pkgs.adwaita-qt;
};
home.sessionVariables.GTK_THEME = "adw-gtk3-dark";
}
Maybe this will help.
If not try to set a base16Scheme in the Stylix configuration and disable polarity = “dark”.
@Postboote This builds but there is no change in QT or GTK apps. This was supposed to be a pretty plug and play integration and its turning into a nightmare. Everyone seems to have a slightly different way of doing it that works for them, but none of those ways are working for me lol.
I solved this, I had set the GTK theme in multiple different spots throughout my configuration which was overriding the stylix module, preventing it from fully theming all apps. If you’re having a similar issue where you have installed everything right but GTK/QT apps are not being themed, check your configuration for GTK or QT settings that are overriding Stylix as it will not automatically call it out in an error.
2 Likes