{ lib, config, pkgs, flakeRoot, ... }: let username = config.defaultUser or "henrov"; moduleName = "stylix"; # Path to stylix assets assetPath = "${flakeRoot}/assets/system/conf/${moduleName}"; # Read all files in the asset directory assetFiles = builtins.attrNames (builtins.readDir assetPath); # Convert files to Home Manager xdg config entries stylixFiles = lib.genAttrs assetFiles (f: { name = ".config/${moduleName}/${f}"; value = { source = "${assetPath}/${f}"; }; }); # Optional stylix.conf contents stylixConfFile = "${assetPath}/stylix.conf"; stylixConf = if builtins.pathExists stylixConfFile then builtins.readFile stylixConfFile else ""; # Cursor defaults cursorName = "phinger-cursors-light"; cursorSize = 24; in { ############################ # System packages ############################ environment.systemPackages = [ pkgs.feh pkgs.st ]; ############################ # Home Manager user-level configuration ############################ # Follow the hyprland pattern to avoid "option does not exist" _module.args.hmUsers = { "${username}" = { # Merge all Stylix asset files into ~/.config/stylix/ home.file = lib.mkMerge stylixFiles; # Include stylix.conf if it exists home.file."${moduleName}/stylix.conf".text = stylixConf; # Session variables for Stylix & cursors home.sessionVariables = { STYLIX_CONF = "$HOME/.config/stylix/stylix.conf"; XCURSOR_THEME = cursorName; XCURSOR_SIZE = toString cursorSize; HYPRCURSOR_THEME = cursorName; HYPRCURSOR_SIZE = toString cursorSize; }; }; }; }