{ config, pkgs, ... }: let configDir = ../../config; # Read the contents of the config directory configEntries = builtins.readDir configDir; # Files to explicitly exclude (handled elsewhere or not intended for ~/.config/) excludedFiles = [ "nomarchy.ttf" ]; # Filter the entries validEntries = builtins.filter (name: !(builtins.elem name excludedFiles)) (builtins.attrNames configEntries); # Generate the xdg.configFile attribute set # For directories, we use `recursive = true;` to allow the user to create their own files alongside the read-only defaults. makeMapping = name: { inherit name; value = { source = "${configDir}/${name}"; recursive = configEntries.${name} == "directory"; }; }; in { xdg.configFile = builtins.listToAttrs (map makeMapping validEntries); }