{ lib, config, pkgs, flakeRoot, home-manager, inputs, ... }: let username = config.defaultUser or "henrov"; assetPath = "${flakeRoot}/generated/.config/hypr"; # Determine Hyprland package (systemwide installation is enough) hyprlandPkg = pkgs.hyprland or pkgs.hyprland-git or inputs.hyprland.packages.${pkgs.system}.default; # Recursively read directory and generate Home Manager file entries rec readDirRecursive = dir: let entries = builtins.attrNames (builtins.readDir dir); files = lib.concatMap (e: let path = "${dir}/${e}"; stat = builtins.pathInfo path; in if stat.type == "directory" then readDirRecursive path else [{ # Destination path relative to home directory name = ".config/hypr/${builtins.substring (builtins.stringLength assetPath + 1) (builtins.stringLength path - (builtins.stringLength assetPath + 1)) path}"; value = { source = path; }; }] ) entries; in files; # Convert list to attribute set (no mkMerge needed) hyprFilesAttrs = lib.listToAttrs (readDirRecursive assetPath); in { # Systemwide installation environment.systemPackages = [ hyprlandPkg ]; # Home Manager users declaration home-manager.users = { ${username} = { # Directly define all config files in ~/.config/hypr/ home.file = hyprFilesAttrs; # Optional Hyprland settings settings.general."col.active_border" = "0xff97cbcd 0xff89b4fa"; }; }; }