{ lib, pkgs, flakeRoot, ... }: let # --- Define user locally --- username = "henrov"; # --- Hyprland conf directory --- hyprConfDir = "${flakeRoot}/assets/hyprland/conf/hypr"; # --- Read files --- hyprlandFiles = builtins.attrNames (builtins.readDir hyprConfDir); # --- Exclude main hyprland.conf from automatic symlinks --- otherHyprlandFiles = lib.filter (name: name != "hyprland.conf") hyprlandFiles; # --- Generate xdg.configFile entries for the other files --- otherConfigs = lib.genAttrs otherHyprlandFiles (name: { target = "hypr/${name}"; source = "${hyprConfDir}/${name}"; }); # --- Add main hyprland.conf separately --- hyprlandConf = { "hypr/hyprland.conf".text = builtins.readFile "${hyprConfDir}/hyprland.conf"; "hypr/.keep".text = ""; }; in { flake.nixosModules.hyprland = { config, pkgs, lib, ... }: { options.mySystem.desktop.hyprland.enable = lib.mkEnableOption "Enable Hyprland Desktop"; config = lib.mkIf (config.mySystem.desktop.hyprland.enable or false) { programs.hyprland.enable = true; home-manager.users.${username} = { home.stateVersion = "25.11"; home.username = username; home.homeDirectory = "/home/${username}"; wayland.windowManager.hyprland = { enable = true; settings.general."col.active_border" = lib.mkForce "0xff97cbcd 0xff89b4fa"; }; xdg.configFile = otherConfigs // hyprlandConf; }; }; }; }