Files
Nomarchy/GEMINI.md
Bernardo Magri 33deeb494b initial commit
2026-04-01 17:06:01 +01:00

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 to modules/system.
    • nixosModules.home: Points to modules/home.
    • nixosConfigurations.installerIso: Generates a bootable ISO importing standard minimal CD modules, adding git, gum, and disko to system packages, and copying install-nomarchy.sh to /etc/.

2. The Interactive Installer (installer/install-nomarchy.sh)

Write a Bash script utilizing gum for UI prompts. The flow must execute as follows:

  1. Hardware Detection: Read /sys/class/dmi/id/product_name and map it to a generic or specific nixos-hardware flake module.
  2. Storage Setup: Prompt user for target drive. Prompt to choose between "Standard Ext4" or "Encrypted BTRFS (LUKS2)". Execute the corresponding Disko .nix file.
  3. User Details: Prompt for target username.
  4. Login Preferences: Prompt to choose between "SDDM Auto-login" (default) or "Require Password". Generate /mnt/etc/nixos/login-preference.nix based on the choice.
  5. Hardware Config: Run nixos-generate-config into /mnt/etc/nixos/.
  6. Handoff Flake Generation: Write a new /mnt/etc/nixos/flake.nix that imports the upstream Nomarchy distribution, the hardware config, the login preference, and sets up the user account.
  7. Version Control: Initialize a git repository in /mnt/etc/nixos/, add files, and make an initial commit.
  8. 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 systemd initrd. 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.nix to conditionally enable autoLogin. 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) and env-update (home-manager switch) in home.shellAliases.
  • Theme Engine: Import nix-colors. Read a local untracked/state variable file (~/.config/home-manager/theme-state.nix) to determine the active theme from nomarchy-palettes.nix.
  • Styling: Inject nix-colors variables (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.writeShellScriptBin script called nomarchy-theme-selector that uses Walker in dmenu mode to select a theme, overwrites theme-state.nix, stages it in git, and runs env-update to hot-reload the UI. Map this script to Super + Alt + Space in Hyprland.

Execution Directives for Agent

  1. Initialize the git repository.
  2. Create the directory skeleton.
  3. Generate the code for each file strictly adhering to declarative Nix principles, except for the installer script.
  4. Ensure all Base16 variables used in Waybar and Walker CSS strings are properly escaped.