flocon/modules/services/gtk.nix
Anthony Rodriguez 6ab835555c
treewide: remove home-manager (switch to hjem)
As my NixOS configuration kept growing, I noticed that I don't need
home-manager as much as I did before. A lot of what I need is just a way
to map nix attrsets to the program's respective configuration format,
which is something that I can now do myself, as my nix knowledge got
more extensive. After all of this, I decided to completely get rid of
home-manager, and switch to a simpler solution called hjem, which just
lets me write files to my home directory that are automatically
symlinked using `systemd-tmpfiles`.

This allows me to simplify my configuration, remove the separation
between NixOS and home-manager modules, and cut my eval times by quite a
lot (which allows for faster `nixos-rebuild switch`!).
2025-01-27 23:57:47 +01:00

40 lines
1.2 KiB
Nix

# heavily borrowed from https://github.com/Lunarnovaa/nixconf/blob/f88254f1938211853f6005426fe19ba4b889e854/modules/desktop/theming/gtk.nix
{
lib,
config,
lib',
...
}: let
inherit (lib'.generators.gtk) finalGtk2Text toGtk3Ini;
inherit (config.local.systemVars) username;
styleCfg = config.local.style;
gtkSettings = with styleCfg; {
gtk-icon-theme-name = gtk.iconTheme.name;
gtk-theme-name = gtk.theme.name;
gtk-cursor-theme-name = cursorTheme.name;
gtk-application-prefer-dark-theme = scheme.variant == "dark";
};
in {
config = with styleCfg;
lib.mkIf styleCfg.enable {
hjem.users.${username} = {
files = {
".gtkrc-2.0".text = finalGtk2Text {attrs = gtkSettings;};
".config/gtk-3.0/settings.ini".text = toGtk3Ini {
Settings = gtkSettings;
};
".config/gtk-4.0/settings.ini".text = toGtk3Ini {
Settings = gtkSettings;
};
".config/gtk-4.0/gtk.css".source = with styleCfg; "${gtk.theme.package}/share/themes/${gtk.theme.name}/gtk-4.0/gtk-dark.css";
};
packages = with styleCfg; [
cursorTheme.package
gtk.theme.package
gtk.iconTheme.package
];
};
};
}