{ lib, config, pkgs, flakeRoot, ... }: let # Resolve the default username username = config.defaultUser or "henrov"; moduleName = "stylix"; # Path to stylix assets assetPath = ../../../assets/system/conf/${moduleName}; # Read all files in the asset directory programFiles = builtins.readDir assetPath; files = lib.genAttrs (builtins.attrNames programFiles) (name: { source = "${assetPath}/${name}"; }); # Optional stylix.conf stylixConfFile = "${assetPath}/stylix.conf"; stylixConf = if builtins.pathExists stylixConfFile then builtins.readFile stylixConfFile else ""; # Cursor defaults cursorName = "phinger-cursors-light"; cursorSize = 24; # Merge all config files + optional stylix.conf into one 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 { ############################ # System packages ############################ environment.systemPackages = [ pkgs.feh pkgs.st ]; ############################ # Home Manager user settings ############################ home-manager.users."${username}" = { # Enable Stylix stylix = { enable = true; # GTK integration for this user targets = { gtk = { enable = true; }; }; }; # Copy all config files into ~/.config/stylix/ home.file = homeFiles; # Session environment variables home.sessionVariables = { STYLIX_CONF = "$HOME/.config/stylix/stylix.conf"; XCURSOR_THEME = cursorName; XCURSOR_SIZE = toString cursorSize; HYPRCURSOR_THEME = cursorName; HYPRCURSOR_SIZE = toString cursorSize; }; }; }