Builder: Technical Documentation
Builder is an intelligent automatic installation and configuration system for the meowrch distribution, written in Python. The system conducts an interactive user survey and performs complete system configuration according to selected parameters.
System Architecture
Section titled “System Architecture”Core Components
Section titled “Core Components”Builder consists of several key modules:
install.py— main module coordinating the entire processquestion.py— interactive user survey systempackages.py— package and category definitionsmanagers/— specialized managers for various installation aspectsutils/— utilities and data schemas
Installation Managers
Section titled “Installation Managers”- PackageManager — manages package installation via pacman and AUR
- FileSystemManager — handles file system operations and dotfiles
- DriversManager — automatic driver detection and installation
- AppsManager — configures specific applications
- ChaoticAurManager — manages Chaotic AUR repository
- PostInstallManager — final post-installation configurations
Installation Stages
Section titled “Installation Stages”1. Initialization and Survey
Section titled “1. Initialization and Survey”Interactive user survey:
self.build_options: BuildOptions = Question.get_answers()The system asks the following questions:
- Backup creation — save existing configurations
- Window manager selection — Hyprland and/or BSPWM
- AUR Helper — choice between yay, paru and their -bin versions
- Chaotic AUR — use precompiled AUR packages
- Drivers — auto-detection and installation of NVIDIA/Intel/AMD
- Firefox extensions — Dark Reader, uBlock Origin, TWP, Unpaywall, Tampermonkey
- Terminal shell — fish or zsh
- User packages — interactive selection by categories
2. Backup Creation
Section titled “2. Backup Creation”if self.build_options.make_backup: FileSystemManager.make_backup()The following configurations are saved:
~/.config/— user configurations~/.local/bin/— user scripts~/.local/share/nemo/— file manager settings- Dotfiles:
.bashrc,.env,.Xresources,.xinitrc ~/.icons/default/index.theme— cursor theme
3. File System Preparation
Section titled “3. File System Preparation”FileSystemManager.create_default_folders()FileSystemManager.copy_dotfiles( exclude_bspwm=not self.build_options.install_bspwm, exclude_hyprland=not self.build_options.install_hyprland,)Creating standard directories:
mkdir -p ~/.config ~/.themes Desktop Downloads Templates Public Documents Music Pictures VideosCopying dotfiles with conditional exclusions:
- If BSPWM is not installed — exclude
bspwm,polybar - If Hyprland is not installed — exclude
hypr,waybar - Setting permissions
chmod -R 700for~/.configand~/.local/bin
4. Package Manager Configuration
Section titled “4. Package Manager Configuration”PackageManager.update_pacman_conf(enable_multilib=True)PackageManager.update_database()Modifying /etc/pacman.conf:
# Enabling performance optionsParallelDownloads = 5VerbosePkgListsILoveCandyColor
# Enabling multilib repository[multilib]Include = /etc/pacman.d/mirrorlistUpdating package database:
sudo pacman -Sy5. Chaotic AUR Installation (Optional)
Section titled “5. Chaotic AUR Installation (Optional)”if self.build_options.use_chaotic_aur: ChaoticAurManager.install()If Chaotic AUR is selected, a repository with precompiled AUR packages is installed to speed up installation.
6. AUR Helper Installation
Section titled “6. AUR Helper Installation”PackageManager.install_aur_helper(self.build_options.aur_helper)Installation process:
- Install dependencies:
git,base-devel - Clone corresponding repository from AUR
- Build and install via
makepkg -si --noconfirm
Supported AUR Helpers:
yay— classic helperparu— modern Rust alternativeyay-bin— precompiled yay versionparu-bin— precompiled paru version
7. Package Installation
Section titled “7. Package Installation”self.packages_installation()An example of a package classification system:
Base Packages
Section titled “Base Packages”# Common packages for all configurationsBASE.pacman.common = [ # Base tools "base-devel", "git", "networkmanager", "libnotify", # Audio subsystem "pipewire", "pipewire-pulse", "pipewire-alsa", "wireplumber", # CLI tools "jq", "fastfetch", "lsd", "bat", "micro", "btop", "yazi", # GUI applications "sddm", "plymouth", "firefox", "kitty", "nemo", "vlc", # Fonts "ttf-hack-nerd", "noto-fonts", "ttf-jetbrains-mono-nerd"]
# BSPWM packagesBASE.pacman.bspwm_packages = [ "xorg", "bspwm", "sxhkd", "polybar", "dunst", "feh"]
# Hyprland packagesBASE.pacman.hyprland_packages = [ "hyprland", "waybar", "hyprlock", "swww", "swaync", "uwsm"]User Packages (CUSTOM)
Section titled “User Packages (CUSTOM)”CUSTOM = { "useful": {"timeshift": PackageInfo("System restore utility")}, "development": {"obsidian": PackageInfo("Knowledge base", recommended=True)}, "social_media": {"telegram-desktop": PackageInfo("Messenger", selected=True)}, "games": {"steam": PackageInfo("Gaming platform", selected=True)}, "entertainment": {"yandex-music": PackageInfo("Music service", aur=True)}, "office": {"onlyoffice-bin": PackageInfo("Office suite", aur=True)}}Package installation algorithm:
- Form pacman and AUR package lists
- Add packages depending on selected WM
- Install in batches of 5 packages for optimization
- On batch failure — individual installation with retries
- Maintain list of uninstalled packages for final report
8. Driver Installation
Section titled “8. Driver Installation”self.drivers_installation()Automatic hardware detection:
@staticmethoddef auto_detection() -> List[str]: drivers = []
# Detection by PCI ID and other methods if "intel" in lspci_output.lower(): drivers.append("Intel") if "nvidia" in lspci_output.lower(): drivers.append("Nvidia") if "amd" in lspci_output.lower() or "ati" in lspci_output.lower(): drivers.append("AMD")
return driversDriver packages by vendor:
Intel:
Section titled “Intel:”"intel": [ "lib32-mesa", "vulkan-intel", "lib32-vulkan-intel", "intel-media-driver", "libva-intel-driver", "xf86-video-intel"]"amd": [ "lib32-mesa", "vulkan-radeon", "lib32-vulkan-radeon"]NVIDIA:
Section titled “NVIDIA:”"nvidia": [ "nvidia-dkms", "nvidia-utils", "lib32-nvidia-utils", "nvidia-settings", "libva-nvidia-driver"]Setting up GPU modules for early boot:
DriversManager.setup_gpu_modules_for_early_boot()Updating /etc/mkinitcpio.conf for correct Plymouth operation with graphics drivers.
9. Application Configuration
Section titled “9. Application Configuration”GRUB Bootloader
Section titled “GRUB Bootloader”AppsManager.configure_grub()Installing custom meowrch theme and updating configuration.
SDDM Display Manager
Section titled “SDDM Display Manager”AppsManager.configure_sddm()Setting up Sugar-Dark theme and autostart configuration.
Plymouth Boot Screen
Section titled “Plymouth Boot Screen”AppsManager.configure_plymouth()Installing animated boot screen.
Firefox
Section titled “Firefox”AppsManager.configure_firefox( darkreader=self.build_options.ff_darkreader, ublock=self.build_options.ff_ublock, # ... other extensions)Automatic installation of selected extensions and settings.
VS Code
Section titled “VS Code”AppsManager.configure_code()Installing themes and basic development extensions.
Pawlette
Section titled “Pawlette”AppsManager.configure_pawlette()Integrating theme management system.
Mewline (only for Hyprland)
Section titled “Mewline (only for Hyprland)”if self.build_options.install_hyprland: AppsManager.configure_mewline()Setting up custom status bar for Hyprland.
10. System Services Configuration
Section titled “10. System Services Configuration”self.daemons_setting()Managing systemd services:
daemons = { "disable": ["sddm.service"], # Disable for manual control "enable": ["NetworkManager", "bluetooth.service"], "start": ["bluetooth.service"]}11. Final Configuration
Section titled “11. Final Configuration”PostInstallation.apply(self.build_options.terminal_shell)Terminal shell configuration:
- Fish: Installing custom functions and aliases
- Zsh: Setting up Oh My Zsh with Powerlevel10k theme
Final operations:
- Updating font database
- Setting up XDG directories
- Applying user settings
- Generating final report
Logging System
Section titled “Logging System”logger.add( sink="build_debug.log", format="{time} | {level} | {message}", level="DEBUG", encoding="utf-8",)The entire installation process is logged with detailed information in the build_debug.log file.
Error Handling
Section titled “Error Handling”Recovery Strategies
Section titled “Recovery Strategies”- Package installation: On batch failure — individual installation
- Retry attempts: Up to 3 attempts for critical operations
- Continue on non-critical errors: System continues work on non-critical errors
- Detailed logging: Saving error information for diagnostics
Final Report
Section titled “Final Report”logger.warning("Pacman: " + ", ".join(self.not_installed_packages.pacman))logger.warning("Aur: " + ", ".join(self.not_installed_packages.aur))At the end of installation, Builder provides a report on packages that could not be installed automatically.
Installation Completion
Section titled “Installation Completion”is_reboot = inquirer.confirm("Do you want to reboot?")if is_reboot: subprocess.run("sudo reboot", shell=True)After successful installation, the system offers a reboot to apply all changes.
Technical Features
Section titled “Technical Features”Performance
Section titled “Performance”- Parallel downloads:
ParallelDownloads = 5in pacman - Batch installation: Installing packages in groups of 5
- Chaotic AUR: Using precompiled packages
- Caching: Reusing downloaded packages
Security
Section titled “Security”- Backup creation: Automatic saving of existing settings
- Validation: Package integrity checking via pacman
- Logging: Detailed logging of all operations
- Access rights: Correct setting of user file permissions
Flexibility
Section titled “Flexibility”- Modularity: Independent managers for different components
- Configurability: Wide customization possibilities through surveys
- Extensibility: Easy addition of new packages and functions
- Compatibility: Support for different hardware configurations
Note: For information on how to start the installation, see Complete Installation Guide.