{ lib, config, pkgs, flakeRoot, ... }: let # --- Program definition --- programName = "stylix"; # Assets (theme + wallpaper) programAssets = "${flakeRoot}/assets/system/theming/${programName}"; programFiles = if builtins.pathExists programAssets then builtins.readDir programAssets else {}; files = lib.genAttrs (builtins.attrNames programFiles) (name: { src = "${programAssets}/${name}"; }); # Enable toggle (must match option) enableProgram = config.enableStylix or true; # Resolve user safely (outside mkIf) user = config.defaultUser or "henrov"; # --- Stylix configuration (self-contained) --- stylixCfg = { enable = true; base16Scheme = "${flakeRoot}/assets/system/theming/stylix/catppuccin-mocha.yaml"; image = "${flakeRoot}/assets/hyprland/wallpaperstuff/pictures/wall1.jpg"; polarity = "dark"; cursor = { package = pkgs.phinger-cursors; name = "phinger-cursors-light"; size = 24; }; fonts = { monospace = { package = pkgs.nerd-fonts.fira-code; name = "Fira Code Nerd Font"; }; sansSerif = { package = pkgs.lato; name = "Lato"; }; }; icons = { enable = true; package = pkgs.papirus-icon-theme; dark = "Papirus-Dark"; light = "Papirus-Light"; }; }; in { # --- Option --- options.enableStylix = lib.mkEnableOption "Enable Stylix system theming"; # --- Config --- config = lib.mkIf enableProgram { # --- Dendritic app definition --- myApps.${programName} = { enable = true; assetsDir = programAssets; files = files; inherit user; theme = "catppuccin-mocha"; polarity = "dark"; }; # --- Stylix theming --- stylix = stylixCfg; # --- Optional: wallpaper helper (kept dendritic) --- myApps.wallpaper = { enable = true; packages = [ "feh" "st" ]; }; # --- Cursor environment variables --- home-manager.users.${user}.home.sessionVariables = { XCURSOR_THEME = stylixCfg.cursor.name; XCURSOR_SIZE = toString stylixCfg.cursor.size; HYPRCURSOR_THEME = stylixCfg.cursor.name; HYPRCURSOR_SIZE = toString stylixCfg.cursor.size; }; }; }