Conversation
|
I've tested that things work with either NixOS standalone or NixOS + Home Manager. The testbed system only provides the latter combination, but changing that isn't directly relevant to this PR, so for now if you want to test it standalone you need to manually remove I've not tested Home Manager standalone as of yet. |
trueNAHO
left a comment
There was a problem hiding this comment.
This PR looks very nice :)
I've not tested Home Manager standalone as of yet.
Considering the or false fallback in
stylix/modules/libadwaita/overlay.nix
Line 7 in bb64123
I believe none of the added code should be triggered on standalone Home Manager. Supporting standalone Home Manager could be done in a follow-up PR:
Updating the Home Manager module to use the new theme package can be done in a separate PR
On a side note, unsure which of "NixOS standalone" and "standalone NixOS" is more "correct", as they imply different hierarchies.
bb64123 to
fedd0f5
Compare
fedd0f5 to
9d767b1
Compare
|
Build failures are:
|
| linkFarm "stylix-gtk" [ | ||
| { | ||
| name = "etc/xdg/gtk-3.0/settings.ini"; | ||
| path = settings; | ||
| } | ||
| { | ||
| name = "etc/xdg/gtk-4.0/settings.ini"; | ||
| path = settings; | ||
| } | ||
| { | ||
| name = "share/themes/Stylix/index.theme"; | ||
| path = index; | ||
| } | ||
| { | ||
| name = "share/themes/Stylix/gtk-3.0/assets"; | ||
| path = "${adw-gtk3}/share/themes/adw-gtk3/gtk-3.0/assets"; | ||
| } | ||
| { | ||
| name = "share/themes/Stylix/gtk-3.0/gtk.css"; | ||
| path = css "gtk-3.0/gtk.css"; | ||
| } | ||
| { | ||
| name = "share/themes/Stylix/gtk-3.0/gtk-dark.css"; | ||
| path = css "gtk-3.0/gtk-dark.css"; | ||
| } | ||
| { | ||
| name = "share/themes/Stylix/gtk-4.0/assets"; | ||
| path = "${adw-gtk3}/share/themes/adw-gtk3/gtk-4.0/assets"; | ||
| } | ||
| { | ||
| name = "share/themes/Stylix/gtk-4.0/gtk.css"; | ||
| path = css "gtk-4.0/gtk.css"; | ||
| } | ||
| { | ||
| name = "share/themes/Stylix/gtk-4.0/gtk-dark.css"; | ||
| path = css "gtk-4.0/gtk-dark.css"; | ||
| } | ||
| ] |
There was a problem hiding this comment.
What about parametrizing on the GTK version to deduplicate:
| linkFarm "stylix-gtk" [ | |
| { | |
| name = "etc/xdg/gtk-3.0/settings.ini"; | |
| path = settings; | |
| } | |
| { | |
| name = "etc/xdg/gtk-4.0/settings.ini"; | |
| path = settings; | |
| } | |
| { | |
| name = "share/themes/Stylix/index.theme"; | |
| path = index; | |
| } | |
| { | |
| name = "share/themes/Stylix/gtk-3.0/assets"; | |
| path = "${adw-gtk3}/share/themes/adw-gtk3/gtk-3.0/assets"; | |
| } | |
| { | |
| name = "share/themes/Stylix/gtk-3.0/gtk.css"; | |
| path = css "gtk-3.0/gtk.css"; | |
| } | |
| { | |
| name = "share/themes/Stylix/gtk-3.0/gtk-dark.css"; | |
| path = css "gtk-3.0/gtk-dark.css"; | |
| } | |
| { | |
| name = "share/themes/Stylix/gtk-4.0/assets"; | |
| path = "${adw-gtk3}/share/themes/adw-gtk3/gtk-4.0/assets"; | |
| } | |
| { | |
| name = "share/themes/Stylix/gtk-4.0/gtk.css"; | |
| path = css "gtk-4.0/gtk.css"; | |
| } | |
| { | |
| name = "share/themes/Stylix/gtk-4.0/gtk-dark.css"; | |
| path = css "gtk-4.0/gtk-dark.css"; | |
| } | |
| ] | |
| linkFarm "stylix-gtk" ( | |
| lib.singleton { | |
| name = "share/themes/Stylix/index.theme"; | |
| path = index; | |
| } | |
| ++ | |
| lib.concatMap | |
| (version: [ | |
| { | |
| name = "etc/xdg/gtk-${version}/settings.ini"; | |
| path = settings; | |
| } | |
| { | |
| name = "share/themes/Stylix/gtk-${version}/assets"; | |
| path = "${adw-gtk3}/share/themes/adw-gtk3/gtk-${version}/assets"; | |
| } | |
| { | |
| name = "share/themes/Stylix/gtk-${version}/gtk.css"; | |
| path = css "${version}/gtk.css"; | |
| } | |
| { | |
| name = "share/themes/Stylix/gtk-${version}/gtk-dark.css"; | |
| path = css "${version}/gtk-dark.css"; | |
| } | |
| ]) | |
| [ | |
| "3.0" | |
| "4.0" | |
| ] | |
| ) |
This could be further deduplicated but would probably not be worth it due to over-engineering.
This adds support for GTK apps at the system level, in addition to the existing Home Manager support. This currently only works for non-libadwaita apps because libadwaita overrides the theme name [1] for compatibility reasons. [1]: https://gitlab.gnome.org/GNOME/libadwaita/-/blob/43192bc3e2870a142e57f971b00b60d69abc9492/src/adw-style-manager.c#L492-495
This adds support for libadwaita apps at the system level, in addition to the existing Home Manager support.
2fdb92b to
4f5bf44
Compare
The
assertion is triggered by Home Manager:
The The
Maybe the
What is the best fix here? |
|
I'm not quite sure why that assertion is triggering but as you say, it's probably because one of the packages was overlayed. In that case it would be possible to change upstream to detect whether the option was changed, rather than comparing its value directly, using something like our check in Lines 189 to 202 in 044ac0c However that isn't the most elegant solution. |
This makes it possible to disable the libadwaita patch without disabling GTK as a whole.
This is in preparation for unifying the implementation of our NixOS and Home Manager modules.
4f5bf44 to
c498b7b
Compare
The diff --git a/modules/programs/mpv.nix b/modules/programs/mpv.nix
index a9b6f8d87..0d41c8e9c 100644
--- a/modules/programs/mpv.nix
+++ b/modules/programs/mpv.nix
@@ -1,6 +1,7 @@
{
config,
lib,
+ options,
pkgs,
...
}:
@@ -216,7 +217,7 @@ in
{
assertions = [
{
- assertion = (cfg.scripts == [ ]) || (cfg.package == pkgs.mpv);
+ assertion = (cfg.scripts == [ ]) || (options.programs.mpv.package.highestPrio >= 1500);
message = ''The programs.mpv "package" option is mutually exclusive with "scripts" option.'';
}
];Not explicitly overriding programs.mpv.package = pkgs.mpv;in our testbed as follows resolves the diff --git a/modules/mpv/testbeds/mpv-uosc.nix b/modules/mpv/testbeds/mpv-uosc.nix
index 25420857..7a57a453 100644
--- a/modules/mpv/testbeds/mpv-uosc.nix
+++ b/modules/mpv/testbeds/mpv-uosc.nix
@@ -11,7 +11,6 @@ in
home-manager.sharedModules = lib.singleton {
programs.mpv = {
enable = true;
- inherit package;
scripts = [ pkgs.mpvScripts.uosc ];
};
};Do our testbeds incorrectly inherit the overlays or is the same behavior expected in end-user configurations? Maybe removing
For reference, treewide removing the |
|
Is there any possibility of this supporting opacity using stylix.opacity.applications? |
Are you referring to the new Either way, this should probably be done in a follow-up PR because the current As previously mentioned, extending the scope should be done in follow-up PRs:
|
This branch (work in progress) adds support for GTK at the NixOS level.
Currently the theme works on non-
libadwaitaapps, and onlibadwaitaapps when$GTK_THEMEis set. I've added a patch to allowlibadwaitato 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_THEMEis meant for debugging purposes, so it takes priority over Home Manager and any imperative settings.The reason why
libadwaitadoes 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
libadwaitainto 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.