{ lib, config, pkgs, flakeRoot, ... }: let username = config.defaultUser or "henrov"; moduleName = "stylix"; assetPath = "${flakeRoot}/assets/system/conf/${moduleName}"; programFiles = builtins.readDir assetPath; files = lib.genAttrs (builtins.attrNames programFiles) (name: { source = "${assetPath}/${name}"; }); stylixConfFile = "${assetPath}/stylix.conf"; stylixConf = if builtins.pathExists stylixConfFile then builtins.readFile stylixConfFile else ""; cursorName = "phinger-cursors-light"; cursorSize = 24; # Merge all config files and optional stylix.conf into a single home.file set homeFiles = lib.recursiveUpdate (lib.genAttrs (builtins.attrNames files) (name: { path = "${moduleName}/${name}"; source = files.${name}.source; })) (if stylixConf != "" then { "${moduleName}/stylix.conf" = { text = stylixConf; }; } else {}); in { environment.systemPackages = [ pkgs.feh pkgs.st ]; home-manager.users."${username}" = { stylix = { enable = true; targets = { gtk = { enable = true; }; }; }; # Single home.file definition, no duplicates home.file = homeFiles; home.sessionVariables = { STYLIX_CONF = "$HOME/.config/stylix/stylix.conf"; XCURSOR_THEME = cursorName; XCURSOR_SIZE = toString cursorSize; HYPRCURSOR_THEME = cursorName; HYPRCURSOR_SIZE = toString cursorSize; }; }; }