fix(configs): declaratively map all upstream config directories
- Replace hardcoded subset with dynamic mapping of the config/ directory - Apply recursive=true to directories to allow downstream user overrides
This commit is contained in:
@@ -1,12 +1,30 @@
|
|||||||
{ config, pkgs, ... }:
|
{ config, pkgs, ... }:
|
||||||
|
|
||||||
{
|
let
|
||||||
xdg.configFile = {
|
configDir = ../../config;
|
||||||
"btop".source = ../../config/btop;
|
|
||||||
"chromium".source = ../../config/chromium;
|
# Read the contents of the config directory
|
||||||
"fastfetch".source = ../../config/fastfetch;
|
configEntries = builtins.readDir configDir;
|
||||||
"kitty".source = ../../config/kitty;
|
|
||||||
"swayosd".source = ../../config/swayosd;
|
# Files to explicitly exclude (handled elsewhere or not intended for ~/.config/)
|
||||||
"xdg-terminals.list".source = ../../config/xdg-terminals.list;
|
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);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user