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

View File

@@ -7,7 +7,7 @@ Users interact with the system by importing the distro's modules into their own
## Directory Structure ## Directory Structure
* `flake.nix` (Master entry point with core modules and test configurations) * `flake.nix` (Master entry point with core modules and test configurations)
* `installer/install-nomarchy.sh` (Interactive installer generating a clean downstream flake) * `installer/install.sh` (Interactive installer generating a clean downstream flake)
* `modules/system/default.nix` (Distro-wide OS defaults: SDDM, Plymouth, Audio, Network) * `modules/system/default.nix` (Distro-wide OS defaults: SDDM, Plymouth, Audio, Network)
* `modules/home/default.nix` (Distro-wide user environment: Hyprland, Waybar, Styling) * `modules/home/default.nix` (Distro-wide user environment: Hyprland, Waybar, Styling)
* `bin/` (The collection of Omarchy productivity and config scripts) * `bin/` (The collection of Omarchy productivity and config scripts)
@@ -20,7 +20,7 @@ Users interact with the system by importing the distro's modules into their own
* **Downstream:** The user's `/etc/nixos/flake.nix` imports the upstream modules. The user's personal customizations are kept in `/etc/nixos/system.nix` and `/etc/nixos/home.nix`. * **Downstream:** The user's `/etc/nixos/flake.nix` imports the upstream modules. The user's personal customizations are kept in `/etc/nixos/system.nix` and `/etc/nixos/home.nix`.
* **Merging:** NixOS automatically merges definitions. For example, if both the distro and the user add packages to `home.packages`, the final system includes the union of both lists. * **Merging:** NixOS automatically merges definitions. For example, if both the distro and the user add packages to `home.packages`, the final system includes the union of both lists.
### 2. The Interactive Installer (`installer/install-nomarchy.sh`) ### 2. The Interactive Installer (`installer/install.sh`)
The installer is designed to bootstrap a fresh system with this modular structure: The installer is designed to bootstrap a fresh system with this modular structure:
1. **Repo Detection:** Identifies the location of the Nomarchy source. 1. **Repo Detection:** Identifies the location of the Nomarchy source.
2. **Scaffolding:** Creates a new downstream `flake.nix` that imports Nomarchy core modules. 2. **Scaffolding:** Creates a new downstream `flake.nix` that imports Nomarchy core modules.
@@ -35,6 +35,6 @@ The installer is designed to bootstrap a fresh system with this modular structur
* **Palettes:** Themes are defined in simple `colors.toml` files. The distro dynamically generates Base16 palettes from these, allowing for infinite theme expansion without modifying Nix code. * **Palettes:** Themes are defined in simple `colors.toml` files. The distro dynamically generates Base16 palettes from these, allowing for infinite theme expansion without modifying Nix code.
## Verification & Build ## Verification & Build
* **Test Installer:** `./bin/nomarchy-test-installer` (Builds a VM of the installer environment). * **Test Installer:** `./bin/utils/nomarchy-test-installer` (Builds a VM of the installer environment).
* **Check Integrity:** `nix flake check --impure` (Verifies all configurations evaluate). * **Check Integrity:** `nix flake check --impure` (Verifies all configurations evaluate).
* **Build ISO:** `nix build .#nixosConfigurations.installerIso.config.system.build.isoImage` (Generates the flashable USB image). * **Build ISO:** `nix build .#nixosConfigurations.installerIso.config.system.build.isoImage` (Generates the flashable USB image).

View File

@@ -13,14 +13,24 @@
--- ---
## 📂 Component-Based Architecture
Nomarchy uses a **Feature-Centric Directory Structure**. Instead of grouping files by type (e.g., all scripts in one folder, all configs in another), everything related to a specific component is colocated.
- **`core/`**: Foundational OS & User defaults (Bootloader, Audio, Bluetooth, basic shell).
- **`features/`**: Isolated modules containing Nix logic, raw dotfiles, and scripts for a specific app or service (e.g., `features/desktop/waybar/`).
- **`themes/`**: The global theming engine. It holds pure color data and logic. *Theme-specific app layouts* (like a custom Waybar layout for `summer-night`) are stored directly inside the app's feature folder (`features/desktop/waybar/themes/`), solving the matrix problem of theming.
---
## 📥 Installation ## 📥 Installation
### 1. Try it in a VM (Recommended) ### 1. Try it in a VM (Recommended)
Verify the experience without touching your hardware: Verify the experience without touching your hardware:
```bash ```bash
./bin/nomarchy-test-installer ./bin/utils/nomarchy-test-installer
``` ```
This builds a full graphical VM of the installer environment. Once inside, click the **Install Nomarchy** icon or run `sudo /etc/install-nomarchy.sh`. This builds a full graphical VM of the installer environment. Once inside, click the **Install Nomarchy** icon or run `nomarchy-install`.
### 2. Build the Installer ISO ### 2. Build the Installer ISO
To install on physical hardware, generate your own bootable image: To install on physical hardware, generate your own bootable image:
@@ -32,14 +42,13 @@ The ISO will be located at `./result/iso/nixos-*.iso`. Flash it to a USB drive a
### 3. Run the Installer ### 3. Run the Installer
Once booted into the Live environment, launch the installer: Once booted into the Live environment, launch the installer:
```bash ```bash
sudo /etc/install-nomarchy.sh nomarchy-install
``` ```
The wizard will guide you through: The wizard will guide you through:
- **Networking:** An interactive wizard to connect to Wi-Fi if needed. - **Networking:** An interactive wizard to connect to Wi-Fi if needed.
- **Hardware:** Optimized profiles for Dell XPS, Framework, Apple T2, and more. - **Hardware:** Optimized profiles for Dell XPS, Framework, Apple T2, and more.
- **Storage:** Choice between Standard Ext4 or Encrypted BTRFS with optional **Impermanence**. - **Storage:** Choice between Standard Ext4 or Encrypted BTRFS with optional **Impermanence**.
- **Localization:** Searchable timezones and keyboard layout selection. - **Localization:** Searchable timezones and keyboard layout selection.
- **Profiles:** One-click setups for Development, Gaming, and Media Production.
--- ---

10
TODO.md
View File

@@ -3,18 +3,18 @@
## 1. Professional Installer [IN PROGRESS] ## 1. Professional Installer [IN PROGRESS]
- [x] Refactor with `gum` for stylized UI. - [x] Refactor with `gum` for stylized UI.
- [x] Add clear section headers and environment checks. - [x] Add clear section headers and environment checks.
- [x] Implement software profile selection. - [ ] Implement software profile selection.
- [ ] Add "Pre-flight Check" summary screen showing all selected options (disk, user, profiles) before proceeding. - [x] Add "Pre-flight Check" summary screen showing all selected options (disk, user, profiles) before proceeding.
- [ ] Implement post-install "Success" dashboard with next steps. - [x] Implement post-install "Success" dashboard with next steps.
- [ ] Improve disk selection to show more metadata (vendor, model, serial). - [ ] Improve disk selection to show more metadata (vendor, model, serial).
## 2. Nomarchy Plymouth Theme [IN PROGRESS] ## 2. Nomarchy Plymouth Theme [DONE]
- [x] Create custom theme assets in `assets/plymouth/`. - [x] Create custom theme assets in `assets/plymouth/`.
- [x] Center official logo on splash screen. - [x] Center official logo on splash screen.
- [x] Declarative integration in `modules/system/plymouth.nix`. - [x] Declarative integration in `modules/system/plymouth.nix`.
- [x] Implement full LUKS password entry support (password prompt, bullet indicators). - [x] Implement full LUKS password entry support (password prompt, bullet indicators).
- [x] Add smooth fade-in/fade-out animations for the logo. - [x] Add smooth fade-in/fade-out animations for the logo.
- [ ] Add system message display (e.g., "Rebooting...", "Checking Disk..."). - [x] Add system message display (e.g., "Rebooting...", "Checking Disk...").
## 3. System Branding (Fastfetch & Terminal) [DONE] ## 3. System Branding (Fastfetch & Terminal) [DONE]
- [x] Restore and optimize official ASCII logo (`logo.txt`). - [x] Restore and optimize official ASCII logo (`logo.txt`).

View File

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 23 KiB

View File

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 23 KiB

View File

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

20
core/default.nix Normal file
View File

@@ -0,0 +1,20 @@
{ config, lib, pkgs, ... }:
{
imports = [
./system/options.nix
./system/state.nix
./system/systemd.nix
../themes/engine/plymouth.nix
../themes/engine/sddm.nix
./system/hardware.nix
./system/audio.nix
./system/bluetooth.nix
./system/network.nix
../features/apps/browser.nix
./system/impermanence.nix
../features/apps/makima.nix
];
time.timeZone = lib.mkDefault config.nomarchy.system.timezone;
}

Some files were not shown because too many files have changed in this diff Show More