|
| 1 | +# AGENTS.md |
| 2 | + |
| 3 | +This file provides guidance to coding agents when working with code in this repository. |
| 4 | + |
| 5 | +## Project Overview |
| 6 | + |
| 7 | +Hypercube is a container-based Linux distribution built on Fedora Atomic (via Universal Blue's `base-main:43`). It's a keyboard-first Hyprland desktop with vim keybindings, Tokyo Night theming, and developer tooling. The image is built as an OCI container and deployed via bootc. |
| 8 | + |
| 9 | +## Build Commands |
| 10 | + |
| 11 | +```bash |
| 12 | +just build # Build container image locally (rootless Podman) |
| 13 | +just build-force # Build without cache |
| 14 | +just build-ghcr # Build for GHCR push (rootful) |
| 15 | +just run # Run container interactively for testing |
| 16 | +just lint # Shellcheck all .sh files |
| 17 | +just format # Format all .sh files with shfmt |
| 18 | +just check # Validate Justfile syntax |
| 19 | +just fix # Fix Justfile formatting |
| 20 | +``` |
| 21 | + |
| 22 | +### VM/ISO Testing |
| 23 | + |
| 24 | +```bash |
| 25 | +just build-qcow2-fast # Create disk image via bootc install |
| 26 | +just run-qcow2 # Test qcow2 in VM with virt-manager |
| 27 | +just build-iso-local # Build ISO from local image |
| 28 | +just run-iso <file> # Test ISO in QEMU VM |
| 29 | +``` |
| 30 | + |
| 31 | +### Package Version Scripts |
| 32 | + |
| 33 | +```bash |
| 34 | +./scripts/packages/check-upstream-versions.sh # Detect upstream updates |
| 35 | +./scripts/packages/check-copr-versions.sh # Compare spec vs COPR builds |
| 36 | +./scripts/packages/test-all.sh # Run package script tests |
| 37 | +``` |
| 38 | + |
| 39 | +## Architecture |
| 40 | + |
| 41 | +### Build Pipeline |
| 42 | + |
| 43 | +The `Containerfile` defines a multi-stage build: |
| 44 | + |
| 45 | +1. **Stage `ctx`**: Aggregates `system_files/` and `build_files/` into `/ctx` |
| 46 | +2. **Main stage**: Builds from `ghcr.io/ublue-os/base-main:43`, mounts `dot_files/` at `/dot_files`, runs `build.sh` |
| 47 | + |
| 48 | +`build_files/shared/build.sh` orchestrates the build: |
| 49 | + |
| 50 | +- Rsyncs `system_files/shared/` to the root filesystem |
| 51 | +- Executes numbered scripts (`00-*.sh` through `99-*.sh`) sequentially from each phase directory |
| 52 | + |
| 53 | +### Build Phases (in order) |
| 54 | + |
| 55 | +| Directory | Purpose | |
| 56 | +| ------------------------ | ----------------------------------------------------- | |
| 57 | +| `build_files/base/` | Kernel, greetd, audio, networking, portals | |
| 58 | +| `build_files/hyprland/` | Compositor, shell, terminal, editor, CLI tools | |
| 59 | +| `build_files/dx/` | Language servers, containers (Distrobox/Podman) | |
| 60 | +| `build_files/apps/` | Applications (Steam, etc.) | |
| 61 | +| `build_files/hypercube/` | Branding, packages, theming, config deployment, tests | |
| 62 | + |
| 63 | +### Configuration System |
| 64 | + |
| 65 | +Configs follow XDG Base Directory specification: |
| 66 | + |
| 67 | +- `dot_files/` → deployed to `/usr/share/hypercube/config/` (system defaults) |
| 68 | +- `/usr/lib/environment.d/60-hypercube-xdg.conf` adds this path to `XDG_CONFIG_DIRS` |
| 69 | +- Users override via `~/.config/` |
| 70 | +- Fish shell configs go to `/etc/fish/` (Fish doesn't use XDG_CONFIG_DIRS) |
| 71 | +- System-level files in `system_files/shared/` mirror the target filesystem path (e.g., `system_files/shared/etc/greetd/config.toml` → `/etc/greetd/config.toml`) |
| 72 | + |
| 73 | +### Build Validation |
| 74 | + |
| 75 | +`build_files/hypercube/99-tests.sh` validates the build by checking: |
| 76 | + |
| 77 | +- Required packages are installed (greetd, hyprland, ghostty, neovim, etc.) |
| 78 | +- Required files exist (branding, configs, themes, plymouth) |
| 79 | +- os-release contains `ID=hypercube` |
| 80 | +- Required services are enabled (greetd, NetworkManager) |
| 81 | + |
| 82 | +Failures exit with code 1, preventing the image from being published. |
| 83 | + |
| 84 | +### COPR Packages |
| 85 | + |
| 86 | +26 custom packages are maintained in `packages/` with RPM spec files. Package metadata, dependencies, and build ordering are defined in `scripts/packages/config.sh`. Packages are built in 5 dependency-ordered batches. |
| 87 | + |
| 88 | +## Shell Script Conventions |
| 89 | + |
| 90 | +- All build scripts use `set -ouex pipefail` |
| 91 | +- Scripts are named with numeric prefixes for execution ordering |
| 92 | +- Package installation uses `dnf5 -y install` |
| 93 | +- COPR repos are enabled with `dnf5 -y copr enable owner/repo` |
| 94 | + |
| 95 | +## Key Integration Points |
| 96 | + |
| 97 | +- **Titanoboa** (`_titanoboa/`): External ISO builder, cloned on demand by `just build-iso-*` |
| 98 | +- **Cosign** (`cosign.pub`): Image signature verification |
| 99 | +- **GitHub Actions** (`.github/workflows/build.yml`): Builds on PR and daily, pushes to GHCR on merge to main |
0 commit comments