Skip to content

Commit a600597

Browse files
committed
feat: added documentation for Custom Packages System
Signed-off-by: Ayush <bhandariayush935@gmail.com>
1 parent 0093444 commit a600597

1 file changed

Lines changed: 52 additions & 9 deletions

File tree

docs/PACKAGES.md

Lines changed: 52 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,22 @@ CodeVerse Linux relies on the standard Arch Linux packaging system (`pacman` and
88

99
The entire process is orchestrated by `scripts/build-packages.sh`.
1010

11+
## Workflow Diagram
12+
13+
```mermaid
14+
graph TD
15+
A[build-packages.sh Execution] --> B[System Check: Verify Rust & Cargo]
16+
B --> C[Asset Fetch: Download GRUB Themes]
17+
C --> D[Generate PKGBUILDs: Write to pkgbuild/]
18+
D --> E[Compile internal packages: cvh-fuzzy, cvh-icons]
19+
E --> F[Resolve AUR dependencies: clone & stage]
20+
F --> G[Execute makepkg: Build .pkg.tar.zst binaries]
21+
G --> H[Stage Binaries: Move to repo/x86_64/]
22+
H --> I[Execute repo-add: Generate cvh-linux.db]
23+
I --> J[Symlink Cleanup: Resolve links for static hosting]
24+
J --> K[Repository Ready: ISO can now consume packages]
25+
```
26+
1127
## Directory Structure
1228

1329
The package management system revolves around three core directories:
@@ -18,32 +34,59 @@ The package management system revolves around three core directories:
1834
2. `pkgbuild/`
1935
Contains the build formulas (`PKGBUILD` files). These files provide instructions to `makepkg` on how to compile the source code, resolve dependencies, and package the compiled binaries into a `.pkg.tar.zst` archive.
2036

21-
3. `repo/x86_64/`
37+
3. `repo/x86_64/`
2238
Acts as the localized pacman repository. This directory stores the compiled packages and the repository databases (`cvh-linux.db`, `cvh-linux.files`). The live ISO configuration treats this directory as an offline package source to pre-install custom software.
2339

40+
## Included Packages and Expected Behavior
41+
42+
The build script compiles a mix of internal projects and external AUR packages to construct the core user experience of CodeVerse Linux.
43+
44+
### Internal Packages
45+
These are developed directly within the repository (source code exists in `src/` or generated via scripts) and establish the custom UI/UX of the distribution.
46+
47+
- **`cvh-branding`**
48+
- **Type:** Configuration & Theming
49+
- **Behavior:** This package modifies the aesthetic of the system. It installs the Tela GRUB bootloader theme, configures the `/etc/motd` terminal welcome message, and provides basic system identification details (`/usr/share/cvh-linux/info`).
50+
51+
- **`cvh-fuzzy`**
52+
- **Type:** Command Line Tool (Rust)
53+
- **Behavior:** Acts as a universal fuzzy finder for the terminal. It provides deep shell integration (Zsh bindings like Ctrl+T and Ctrl+R for files and command history) to rapidly navigate directories and commands.
54+
55+
- **`cvh-icons`**
56+
- **Type:** Desktop Utility (Rust & Lua)
57+
- **Behavior:** Provides sandboxed, Lua-scriptable desktop icons tailored for the Wayland compositor. It draws interactive desktop icons and handles configurations spanning layout structure, grid sizing, and theme colors.
58+
59+
### External AUR Dependencies
60+
The build system acts as an AUR helper during compilation, pulling complex dependencies that the CodeVerse stack relies upon.
61+
62+
- **`mpvpaper`** (and related dependencies)
63+
- **Type:** Wayland Tooling
64+
- **Behavior:** Grants the system the capability to render live video wallpapers directly onto the Wayland background surface.
65+
2466
## The Build Process
2567

2668
When `scripts/build-packages.sh` is executed, the following sequence occurs:
2769

2870
1. **Pre-requisite Checks**: Verifies that the Rust toolchain and standard build utilities are available.
29-
2. **Asset Generation**: Pulls necessary UI assets, such as GRUB themes, from remote repositories and stages them.
30-
3. **PKGBUILD Generation**: Dynamically generates `PKGBUILD` files for internal project components (`cvh-branding`, `cvh-fuzzy`, `cvh-icons`) and places them inside the `pkgbuild/` subdirectories.
31-
4. **Compilation**: Compiles custom software located in `src/` and builds the Arch packages using `makepkg`.
32-
5. **AUR Dependency Resolution**: Clones required AUR packages, builds them locally, and stages the resulting packages alongside the internal ones.
71+
2. **Asset Generation**: Pulls necessary UI assets, such as GRUB themes, from remote repositories and stages them according to the `1080p` display profile.
72+
3. **PKGBUILD Generation**: Dynamically writes `PKGBUILD` files for internal project components (`cvh-branding`, `cvh-fuzzy`, `cvh-icons`) and places them inside the `pkgbuild/` subdirectories.
73+
4. **Compilation**: Compiles custom software located in `src/` utilizing the `cargo` build system, and wraps them into Arch packages using `makepkg`.
74+
5. **AUR Dependency Resolution**: Clones required AUR packages (like `mpvpaper`), builds them locally through `makepkg`, and stages the resulting packages alongside the internal ones.
3375
6. **Repository Database Update**: Moves all `.pkg.tar.zst` files into `repo/x86_64/` and executes `repo-add` to construct the pacman database.
3476

3577
## Special Cases and Technical Considerations
3678

3779
### 1. Root Execution Constraints
38-
Arch Linux's `makepkg` utility strictly prohibits execution as the root user to prevent packages from accidentally modifying the host operating system during compilation. If you are building the ISO inside a Docker container (which defaults to root), you must execute the package build process under an unprivileged user account. The provided Docker setups and continuous integration workflows handle this automatically by isolating the build environment to a standard user.
80+
Arch Linux's `makepkg` utility strictly prohibits execution as the root user to prevent packages from accidentally modifying the host operating system during compilation. If you are building the ISO inside a Docker container (which defaults to root), you must execute the package build process under an unprivileged user account. The provided Docker setups and continuous integration workflows handle this automatically by isolating the build environment to a standard user via `runuser`.
3981

4082
### 2. Symlink Resolution for Remote Hosting
41-
By default, the `repo-add` utility creates symbolic links for the repository databases (e.g., `cvh-linux.db` points to `cvh-linux.db.tar.gz`). However, when hosting the repository via static file servers or raw repositories (such as GitHub Raw URLs), symbolic links are usually not resolved.
83+
By default, the `repo-add` utility creates symbolic links for the repository databases (e.g., `cvh-linux.db` points to `cvh-linux.db.tar.gz`). However, when hosting the repository via static file servers or raw repositories (such as GitHub Raw URLs), symbolic links are usually not resolved natively by the HTTP server.
4284

43-
To circumvent this, the `build-packages.sh` script includes a dedicated step that explicitly removes the symbolic links and replaces them with hard copies of the actual database files. This ensures `pacman` can retrieve the databases seamlessly when pulling from an external origin.
85+
To circumvent this, the `build-packages.sh` script includes a dedicated step that explicitly removes the symbolic links and replaces them with hard file copies of the actual database tarballs. This ensures `pacman` can retrieve the databases seamlessly when pulling from an external static origin.
4486

4587
### 3. Modifying Built-in Packages
4688
If you need to update a custom package or modify a `PKGBUILD`:
47-
- Do not edit the auto-generated `PKGBUILD` files in `pkgbuild/` directly, as they will be overwritten on the next build. Instead, update the generation logic inside `scripts/build-packages.sh`.
89+
- Do not edit the auto-generated `PKGBUILD` files in `pkgbuild/` directly, as they will be wiped and rewritten on the next build. Instead, update the generation logic inside the `scripts/build-packages.sh` shell script.
90+
- To add a new internal package, you must append its build logic to `scripts/build-packages.sh` and ensure its source lives inside `src/`.
4891
- To add a new AUR package, add the package name to the array located in the `build_aur_packages` function of the build script.
4992
- Execute `scripts/build-packages.sh` to compile any structural changes and update the corresponding hashes in the database.

0 commit comments

Comments
 (0)