danth / stylix

System-wide colorscheming and typography for NixOS
https://stylix.danth.me/
MIT License
1.16k stars 143 forks source link

GTK CSS not installing #213

Closed cvincent closed 9 months ago

cvincent commented 9 months ago

Hello, and thank you for this awesome project.

I have Stylix installed as a NixOS module, and I am running Home Manager. My config is a flake. Most things seem to be working. Chromium was immediately restyled, and to my delight even the system console took the colors I wanted, I didn't even know that was possible!

The one thing that I can't seem to get working is GTK styling. I tried putting gtk.enable = true in my Home Manager config, and programs.dconf.enable = true in both my system and HM configs, even though these options seem like they would be set by Stylix for me. I've tried reading through the Stylix source and, though I am still pretty new to Nix, from what I can tell it should work. But the only files linked in .config/gtk-3.0 and .config/gtk-4.0 are settings.ini, which only appeared after I manually placed gtk.enable = true in my HM config. This is after rebuilding both the system and HM.

Happy to answer any questions which can help debug. Thanks again!

danth commented 9 months ago

Could it be that Stylix isn't imported into your Home Manager config at all? Chromium and the system console are both modules which don't rely on Home Manager. Do you use Home Manager within your NixOS configuration, or independently?

cvincent commented 9 months ago

It's within my NixOS configuration, as a module e.g.:

homeConfigurations = {
  cvincent = home-manager.lib.homeManagerConfiguration {
    inherit pkgs;
    # etc...
danth commented 9 months ago

That looks like an independent configuration in flake.nix. Try importing stylix.homeManagerModules.stylix under Home Manager. You'll also need to import your theme settings into both configs.

https://danth.github.io/stylix/installation.html#home-manager

cvincent commented 9 months ago

That did do the trick! I guess I was confused by these lines in the installation documentation:

Installing Home Manager as a NixOS module is highly recommended if you don't use it already. This will combine it with your existing configuration, so you don't need to run any extra commands when you rebuild, and the theme you set in NixOS will automatically be used for Home Manager too.

When Stylix is installed to a NixOS configuration, it will automatically set up its Home Manager modules if it detects that Home Manager is available. You can theoretically use it without installing Home Manager, however most features will be unavailable.

And under the Home Manager heading, it seemed to suggest a separate import was only necessary for standalone (as opposed to module) HM or if I was opting into configuring Stylix for it separately.

Anyways, glad to have it working, and thanks for the help! That's another item checked off in my NixOS setup journey.

danth commented 9 months ago

I think you're misunderstanding the difference between separate configs within the same flake (which seems to be what you have), vs configs which are truly combined.

With a truly combined config, you most likely wouldn't use home-manager.lib.homeManagerConfiguration at all. Instead, you'd import home-manager.nixosModules.home-manager on the NixOS side and then configure Home Manager from same file as NixOS using something like:

{
  home-manager.users.cvincent = {
    ...
  };
}

This is the only setup where Stylix can automatically import its Home Manager modules.