Files
chiasson-nix/modules/wisdom/desktop/gtk-qt-theming.nix
T
Olivier 13f35677be refactor(wisdom): decentralize module defaults and update conventions
Move Home Manager module defaults from a centralized `desktop-home-defaults.nix`
file into their respective `wisdom` slices. This change aligns with the
updated documentation regarding module ownership, where defaults live
with the option that owns them rather than in a shared defaults file.

Additionally, update `docs/conventions.md` to reflect this new pattern for
defining `mkEnableOption` defaults and move base git/encryption
configurations into the core `wisdom` module.

- Delete `modules/hosts/desktop-home-defaults.nix`
- Update `modules/wisdom/default.nix` to include shared git and package defaults
- Add `default = ...` to `mkEnableOption` in various `wisdom` modules
- Update `docs/conventions.md` with new HM slice guidelines
2026-07-16 13:51:48 -03:00

143 lines
4.1 KiB
Nix

{ ... }: {
flake.homeManagerModules.wisdomDesktopGtkQtTheming =
{ config, lib, pkgs, osConfig ? { }, ... }:
let
root = config.chiasson.home;
cfg = config.chiasson.home.desktop.theming;
dmsShell = (lib.attrByPath [ "chiasson" "desktop" "shell" ] null osConfig) == "dms";
qtPlatformTheme = if dmsShell then "qt6ct" else cfg.qt.platformTheme;
in
{
options.chiasson.home.desktop.theming = {
enable = lib.mkEnableOption ''
WhiteSur GTK + icon themes, Phinger cursor, and Qt via qt6ct (DMS) or KDE platform theme.
Matugen accent colors load via gtk3/gtk4 extraCss when matugenGtkColors is enabled.
'' // {
default = true;
};
matugenGtkColors = lib.mkOption {
type = lib.types.bool;
default = true;
description = ''
Add `@import url("dank-colors.css");` to gtk3/gtk4 extraCss (DMS matugen writes the file).
'';
};
gtkTheme = {
name = lib.mkOption {
type = lib.types.str;
default = "WhiteSur-Dark";
};
package = lib.mkOption {
type = lib.types.package;
default = pkgs.whitesur-gtk-theme;
};
};
iconTheme = {
name = lib.mkOption {
type = lib.types.str;
default = "WhiteSur-dark";
};
package = lib.mkOption {
type = lib.types.package;
default = pkgs.whitesur-icon-theme;
};
};
cursor = {
name = lib.mkOption {
type = lib.types.str;
default = "phinger-cursors-dark";
};
package = lib.mkOption {
type = lib.types.package;
default = pkgs.phinger-cursors;
};
size = lib.mkOption {
type = lib.types.int;
default = 32;
};
};
qt = {
platformTheme = lib.mkOption {
type = lib.types.str;
default = "kde";
description = ''
`QT_QPA_PLATFORMTHEME` when not using DMS shell. DMS hosts use qt6ct automatically.
'';
};
extraPackages = lib.mkOption {
type = lib.types.listOf lib.types.package;
default = [ pkgs.kdePackages.qt6ct ];
description = "Qt platform integration packages.";
};
};
};
config = lib.mkIf (root.enable && cfg.enable) (lib.mkMerge [
{
home.packages =
if dmsShell then
[ pkgs.kdePackages.qt6ct ]
else
cfg.qt.extraPackages;
home.sessionVariables = {
QT_QPA_PLATFORMTHEME = qtPlatformTheme;
}
// lib.optionalAttrs (qtPlatformTheme == "qt6ct") {
QT_QPA_PLATFORMTHEME_QT6 = "qt6ct";
};
home.pointerCursor = {
name = cfg.cursor.name;
package = cfg.cursor.package;
size = cfg.cursor.size;
gtk.enable = true;
x11.enable = true;
};
gtk = {
enable = true;
theme = {
name = cfg.gtkTheme.name;
package = cfg.gtkTheme.package;
};
iconTheme = {
name = cfg.iconTheme.name;
package = cfg.iconTheme.package;
};
cursorTheme = {
name = cfg.cursor.name;
package = cfg.cursor.package;
size = cfg.cursor.size;
};
gtk3.extraConfig = {
gtk-application-prefer-dark-theme = 1;
};
gtk4 = {
theme = {
name = cfg.gtkTheme.name;
package = cfg.gtkTheme.package;
};
extraConfig = {
gtk-application-prefer-dark-theme = 1;
};
};
};
}
(lib.mkIf cfg.matugenGtkColors {
gtk.gtk3.extraCss = ''
@import url("dank-colors.css");
'';
gtk.gtk4.extraCss = ''
@import url("dank-colors.css");
'';
})
]);
};
}