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

87
features/default.nix Normal file
View File

@@ -0,0 +1,87 @@
{ config, pkgs, inputs, lib, ... }:
let
nomarchyLib = import ../lib { inherit lib; };
userPackagesFile = "${config.home.homeDirectory}/.config/home-manager/user-packages.json";
userPackages = if builtins.pathExists userPackagesFile then
let
pkgNames = builtins.fromJSON (builtins.readFile userPackagesFile);
# Filter to only packages that exist in pkgs to prevent build failures
validPkgs = builtins.filter (name: builtins.hasAttr name pkgs) pkgNames;
in builtins.map (name: pkgs.${name}) validPkgs
else [];
in
{
imports = [
inputs.nix-colors.homeManagerModules.default
inputs.walker.homeManagerModules.default
../themes/engine/stylix-compat.nix
../core/home/options.nix
../core/home/state.nix
../core/home/overrides.nix
../core/home/behavior.nix
../themes/engine/loader.nix
../themes/engine/files.nix
../core/home/fonts.nix
./apps/alacritty/default.nix
./desktop/nightlight.nix
./desktop/idle.nix
../themes/engine/stylix.nix
./desktop/hyprland/default.nix
./desktop/waybar/default.nix
./apps/walker.nix
../themes/engine/switcher.nix
./scripts/default.nix
../core/home/configs.nix
./apps/swayosd.nix
../core/home/security.nix
./scripts/battery-monitor.nix
../core/home/bash.nix
];
colorScheme = lib.mkDefault (nomarchyLib.getColorScheme config.nomarchy.theme);
# Enable neovim program module (required for stylix integration)
programs.neovim.enable = lib.mkDefault true;
home.packages = lib.mkDefault (with pkgs; [
# Core applications
firefox
xfce.thunar
# Media
imv # Image viewer
mpv # Video player
# Hyprland ecosystem
swww # Wallpaper daemon
mako # Notification daemon
hyprlock # Lock screen
# Screenshot and clipboard
wl-clipboard
grim
slurp
# Hardware control
brightnessctl
playerctl
pamixer
# Utilities
jq
xmlstarlet
mise
gum # TUI components for scripts
# Theming
yaru-theme
bibata-cursors
# Fonts
nerd-fonts.jetbrains-mono
nerd-fonts.roboto-mono
nerd-fonts.fira-code
nerd-fonts.ubuntu-mono
] ++ userPackages);
}