Files
Nomarchy/modules/home/stylix.nix
Bernardo Magri 42f515f4a9 feat(themes): declaratively manage icons, cursors, and dark/light modes
- Automatically detect light mode via 'light.mode' file in theme folder
- Read icon theme name from 'icons.theme' file in theme folder
- Switch Stylix polarity and iconTheme based on theme selection
- Add yaru-theme and bibata-cursors to default packages
- Remove obsolete imperative nomarchy-theme-set-gnome script
2026-04-04 18:33:00 +01:00

78 lines
1.9 KiB
Nix

{ config, pkgs, inputs, lib, ... }:
let
# Re-use our state-based logic
palettes = import ../../themes/nomarchy-palettes.nix;
activeThemeName = config.nomarchy.theme;
activeWallpaper = if config.nomarchy.wallpaper != "" then
config.nomarchy.wallpaper
else "${../../themes/catppuccin/backgrounds/1-totoro.png}"; # Fallback
# Map nix-colors palette to a format Stylix expects (attrset of hex strings)
currentPalette = (palettes.${activeThemeName} or palettes.nord).palette;
in
{
imports = [ inputs.stylix.homeModules.stylix ];
stylix = {
enable = true;
enableReleaseChecks = false;
image = activeWallpaper;
base16Scheme = currentPalette;
# Use detected light mode state
polarity = if config.nomarchy.isLightMode then "light" else "dark";
cursor = {
package = config.nomarchy.cursor.package;
name = config.nomarchy.cursor.name;
size = 24;
};
fonts = {
monospace = {
package = pkgs.nerd-fonts.jetbrains-mono;
name = config.nomarchy.fonts.monospace;
};
sansSerif = {
package = pkgs.dejavu_fonts;
name = "DejaVu Sans";
};
serif = {
package = pkgs.dejavu_fonts;
name = "DejaVu Serif";
};
emoji = {
package = pkgs.noto-fonts-color-emoji;
name = "Noto Color Emoji";
};
sizes = {
applications = 11;
terminal = 11;
desktop = 11;
popups = 11;
};
};
# Enable theming for specific targets
targets = {
hyprland.enable = false; # We keep our custom hyprland config for borders/rules
waybar.enable = false; # We keep our custom waybar CSS
alacritty.enable = true;
kitty.enable = true;
gtk.enable = true;
gnome.enable = true;
};
};
# GTK Icon Theme configuration
gtk = {
enable = true;
iconTheme = {
package = pkgs.yaru-theme;
name = config.nomarchy.iconsTheme;
};
};
}