Skip to content

Conversation

@danth
Copy link
Member

@danth danth commented Dec 26, 2025

This branch (work in progress) adds support for GTK at the NixOS level.

Currently the theme works on non-libadwaita apps, and on libadwaita apps when $GTK_THEME is set. I've added a patch to allow libadwaita to load the theme by default, but I've not had time to test this yet, since it causes most apps on my system to be built from source. The patch is necessary since $GTK_THEME is meant for debugging purposes, so it takes priority over Home Manager and any imperative settings.

The reason why libadwaita does not load themes by default is because they create additional work for upstream maintainers who never intended for their app to be themed. As a general note, we might want to add a warning in our README about this, asking users to disable Stylix before sending any bug reports upstream.

Before this is merged, it seems like a good idea to split libadwaita into a separate target, so that users can disable the overlay if none of their apps need it.

Later, I believe the Home Manager module could be refactored to use the same theme package I've created here.


@stylix-automation stylix-automation bot added topic: nixos NixOS target topic: overlay Overlay changes topic: modules /modules/ subsystem labels Dec 26, 2025
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before this is merged, it seems like a good idea to split libadwaita into a separate target, so that users can disable the overlay if none of their apps need it.

I feel that it should also be disabled by default, as rebuilding all libadwaita pacakges can be extremely compute and time consuming.


side note: I feel the same about gtksourceview

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that makes sense. I opened #2112 with some more ideas.

Although note that this patch is independent of the theme used, so it should be available from the nix-community binary cache, at least for packages that are used in one of our testbeds.

Comment on lines +9 to +10
&& config.stylix.targets ? gtk
&& config.stylix.targets.gtk.enable
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
&& config.stylix.targets ? gtk
&& config.stylix.targets.gtk.enable
&& config.stylix.targets.gtk.enable or false

extension = ".css";
};

theme =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this seem unnecessarily to have in a let in block, why not just inline it?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm planning to move it to a separate file so that we can reuse it for Home Manager.

Later, I believe the Home Manager module could be refactored to use the same theme package I've created here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

topic: modules /modules/ subsystem topic: nixos NixOS target topic: overlay Overlay changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants