refactor: implement component-based architecture for enhanced maintainability

- Reorganize directory structure into core/, features/, and themes/
- Colocate application Nix logic, configs, scripts, and theme overrides
- Implement 'Inversion of Control' for theming: apps now pull theme-specific layouts
- Update flake.nix and shared library paths to match the new structure
- Document the new Feature-Centric architecture in README.md
This commit is contained in:
Bernardo Magri
2026-04-12 14:51:15 +01:00
parent a9ee79a5ce
commit bbdf34ced8
535 changed files with 119 additions and 127 deletions

69
core/home/configs.nix Normal file
View File

@@ -0,0 +1,69 @@
{ config, pkgs, lib, ... }:
let
configDir = ../../config;
# Explicit list of config items to manage
# This replaces dynamic builtins.readDir for clarity and faster evaluation
configItems = {
# Directories
btop = "directory";
chromium = "directory";
elephant = "directory";
"environment.d" = "directory";
fastfetch = "directory";
fcitx5 = "directory";
fontconfig = "directory";
ghostty = "directory";
git = "directory";
hypr = "directory";
"hyprland-preview-share-picker" = "directory";
imv = "directory";
kitty = "directory";
lazygit = "directory";
nomarchy = "directory";
opencode = "directory";
systemd = "directory";
tmux = "directory";
Typora = "directory";
uwsm = "directory";
wiremix = "directory";
xournalpp = "directory";
# Files
"brave-flags.conf" = "regular";
"chromium-flags.conf" = "regular";
"starship.toml" = "regular";
"xdg-terminals.list" = "regular";
};
# Files/directories handled elsewhere or not intended for ~/.config/
# - nomarchy.ttf: font file, not a config
# - waybar: handled in waybar.nix
# - walker: handled in walker.nix
# - alacritty: handled in alacritty.nix
# - swayosd: handled in swayosd.nix
# Check for user overrides
userConfigDir = config.nomarchy.configOverrides;
hasUserOverrides = userConfigDir != null && builtins.pathExists userConfigDir;
# Generate the xdg.configFile attribute set
makeMapping = name: type:
let
hasUserOverride = hasUserOverrides && builtins.pathExists "${userConfigDir}/${name}";
source = if hasUserOverride then "${userConfigDir}/${name}" else "${configDir}/${name}";
in {
inherit name;
value = lib.mkDefault {
inherit source;
recursive = type == "directory";
};
};
configMappings = lib.mapAttrs' (name: type: makeMapping name type) configItems;
in
{
xdg.configFile = configMappings;
}