$ show ChimeraOS/chimeraos
ChimeraOS is a build system for creating a custom Arch Linux-based operating system image tailored for gaming consoles. It provides a set of shell scripts, configuration files, and GitHub Actions workflows to assemble a complete system image with Steam, RetroArch, gamescope, and other gaming-related packages. The build process uses a Docker container to create a reproducible environment, installs packages from Arch repositories and the AUR, applies custom configurations, and produces a compressed Btrfs image. The repository includes scripts for session management, hardware quirks, and system migrations, all designed to create a console-like experience on PC hardware. It is not a runtime application but a build toolchain, and the code is well-structured for its purpose, with several reusable utility scripts and migration patterns.
The LLM identified 4 files worth highlighting for reuse:
A robust bash script to create a swapfile with proper checks for free space, existing file, and Btrfs compatibility. It uses chattr +C and btrfs property to set nodatacow, and dd to allocate the file. This script is isolated, self-contained, and could be reused in any Linux system that needs to create a swapfile, especially on Btrfs.
A Polkit helper script that allows writing to specific sysfs paths (e.g., backlight brightness, power limits, LED brightness). It uses pkexec to elevate privileges and logs operations via systemd-cat. The script validates each path against a whitelist and either commits or declines the write. This pattern is reusable for any project needing controlled privileged writes to hardware files.
A wrapper script around wpctl (WirePlumber control tool) that intercepts calls from Steam to prevent it from resetting the audio default. It uses pstree to detect if the parent process is Steam and silently ignores certain commands. This demonstrates a clever use of process tree inspection to apply workarounds, and the pattern of wrapping a command to add conditional behavior is reusable.
A migration script that removes a broken swapfile (zero-size). It checks if the swapfile exists and has non-zero size before removing it. This is a simple, idempotent pattern for fixing common system issues during upgrades. The script is self-contained and could be adapted for other migration tasks.