4.9 KiB
4.9 KiB
Nomarchy - A NixOS-based distribution with Omarchy flavour - Agent Build Blueprint
System Architecture Overview
You are tasked with generating a NixOS-based Linux distribution monorepo that perfectly replicates the Omarchy Wayland workflow. The architecture relies on a strictly declarative Nix Flake setup, separated into System-level configurations (NixOS) and User-level configurations (Standalone Home Manager).
The goal is to provide an upstream repository that users can import into their own downstream flake.nix files, allowing them to keep the core Omarchy aesthetic while maintaining their own custom packages and development environments.
Directory Structure
Generate the repository using the following exact structure:
flake.nix(Master entry point)installer/install-nomarchy.sh(Bash/Gum interactive installer)installer/disko-ext4.nix(Standard drive layout)installer/disko-btrfs-luks.nix(Encrypted snapshot layout)modules/system/default.nix(Core OS module)modules/system/plymouth.nix(Boot splash)modules/system/sddm.nix(Display manager logic)modules/home/default.nix(Core Nomarchy user environment)modules/home/hyprland.nix(Window manager)modules/home/waybar.nix(Status bar)modules/home/walker.nix(App launcher and menus)modules/home/theme-switcher.nix(State file and scripts)themes/nomarchy-palettes.nix(Base16 Nix-colors dictionaries)hosts/live-iso.nix(Bootable USB configuration)
Core Components & Logic
1. The Master Flake (flake.nix)
- Inputs required:
nixpkgs(unstable),nixos-hardware,disko,home-manager,nix-colors. - Outputs required: *
nixosModules.system: Points tomodules/system.nixosModules.home: Points tomodules/home.nixosConfigurations.installerIso: Generates a bootable ISO importing standard minimal CD modules, addinggit,gum, anddiskoto system packages, and copyinginstall-nomarchy.shto/etc/.
2. The Interactive Installer (installer/install-nomarchy.sh)
Write a Bash script utilizing gum for UI prompts. The flow must execute as follows:
- Hardware Detection: Read
/sys/class/dmi/id/product_nameand map it to a generic or specificnixos-hardwareflake module. - Storage Setup: Prompt user for target drive. Prompt to choose between "Standard Ext4" or "Encrypted BTRFS (LUKS2)". Execute the corresponding Disko
.nixfile. - User Details: Prompt for target username.
- Login Preferences: Prompt to choose between "SDDM Auto-login" (default) or "Require Password". Generate
/mnt/etc/nixos/login-preference.nixbased on the choice. - Hardware Config: Run
nixos-generate-configinto/mnt/etc/nixos/. - Handoff Flake Generation: Write a new
/mnt/etc/nixos/flake.nixthat imports the upstream Nomarchy distribution, the hardware config, the login preference, and sets up the user account. - Version Control: Initialize a git repository in
/mnt/etc/nixos/, add files, and make an initial commit. - Execution: Run
nixos-install --flake /mnt/etc/nixos#default --no-root-passwd.
3. Disko Configurations
- Ext4: Single EFI partition, single Ext4 root partition.
- BTRFS+LUKS: EFI partition, LUKS2 encrypted container holding a BTRFS filesystem. Subvolumes must include
@(root),@home(user data),@nix(Nix store), and@log(logs).
4. System Modules (modules/system/)
- Boot: Enable
systemdinitrd. Enable Plymouth with a custom Nomarchy theme derivation. Silence kernel logs completely (quiet splash loglevel=3). - Login: Enable SDDM with Wayland support. Read the generated
login-preference.nixto conditionally enableautoLogin. Enable Hyprland system-level dependencies.
5. Home Manager & Theming (modules/home/)
- Architecture: Must remain standalone (not built into the system NixOS config).
- Aliases: Define
sys-update(sudo nixos-rebuild switch) andenv-update(home-manager switch) inhome.shellAliases. - Theme Engine: Import
nix-colors. Read a local untracked/state variable file (~/.config/home-manager/theme-state.nix) to determine the active theme fromnomarchy-palettes.nix. - Styling: Inject
nix-colorsvariables (e.g.,${config.colorScheme.palette.base00}) into Hyprland borders, Waybar CSS, Alacritty colors, and Walker CSS. - Walker & Scripting: Configure Walker to run as a service. Write a
pkgs.writeShellScriptBinscript callednomarchy-theme-selectorthat uses Walker indmenumode to select a theme, overwritestheme-state.nix, stages it in git, and runsenv-updateto hot-reload the UI. Map this script toSuper + Alt + Spacein Hyprland.
Execution Directives for Agent
- Initialize the git repository.
- Create the directory skeleton.
- Generate the code for each file strictly adhering to declarative Nix principles, except for the installer script.
- Ensure all Base16 variables used in Waybar and Walker CSS strings are properly escaped.