site logo

Hosting Custom Arch Linux Repositories on Gitlab Pages

Arch User Repository (AUR) is objectively the magnum opus of Arch Linux. You can basically find anything in there. Java, IDEs, everything. Hell, maybe even viruses. No need to say, it is objectively the best part of the Arch Linux experience.

Personally, I use the networkmanager-iwd AUR package to replace wpa_supplicant stuff with iwd. iwd, developed by Intel, somehow makes my laptop’s WiFi connection much more stable. networkmanager-iwd furthermore replaces NetworkManager’s default WiFi backend with iwd. It works great.

However, networkmanager-iwd is not a binary package. Each time it updates, my laptop has to compile the whole NetworkManager from source. Needless to say, compiling such thing on my puny 4 core Core(tm) i7-1165G7, is a disaster.

So why not build a custom Arch Linux repository with the compiled versions? Yep.

Infrastructure

Turned out continuous integration systems is perfect for this, specifically Gitlab (and Github). We can compile packages from source with Gitlab CI, then host the binary packages on Gitlab Pages.

architecture of an automated Arch repo

Even better, it’s completely free.

Setup

I have created a template repository containing the package networkmanager-iwd and yay-bin. To start, fork this repository.

It contains

  • .gitlab-ci.yml, the CI configuration
  • build.sh, the building script
  • Several submodules containing build files of their respective packages

The build script iterates through all directories, runs makepkg -s, and copies the compiled package into root directory. The page setup script in .gitlab-ci.yml simply copies compiled packages into public, and updates the repository database with repo-add.

You might need to remove the

tags:
    - heavyweapons

from .gitlab-ci.yml, as I used a custom CI runner.

Before triggering CI, add a custom CI variable REPO_NAME. This determines the name of your custom repository.

Configuration

After the CI has run its course, your custom Arch Linux should be live! To check, open https://gitlab-pages-url/x86_64/REPO_NAME.db. You should be able to download your repo db file.

To add your custom repo to your Arch installation, add the following to /etc/pacman.conf:

[<REPO_NAME>]
SigLevel = Optional TrustAll
Server = https://<gitlab-pages-url>/$arch

Now, run

sudo pacman -Syy

And we are done! No more compiling packages from scratch.

Add Other Packages

To add a new custom package, you can simply clone the AUR repository as a submodule.

cd arch
git clone https://aur.archlinux.org/tensorflow-rocm.git

Congratulations. You have now saved half an hour of your laptop’s battery life, and more importantly 5 minutes of your life, from compiling AUR packages.