kota.nz notes vids pics code about
Well, it’s been a few months since I’ve written. I had to renew my visa and I found a new job so I’ve been exceptionally busy. Things are finally starting to slow down again. Yesterday, I found the time to create my own personal package repository for Void Linux. I’ve been meaning to do this for ages, but always put it off; turns out it was much easier than I expected!
I quite like Void! It uses a rolling release model, but the packages tend to track stable releases and lag behind a bit compared to say Arch. There’s a few novel things such as using runit as the init system (instead of systemd) and having a musl libc version which can be used instead of glibc. I’m running glibc at the moment though as I still play video games sometimes.
A good friend of mine also uses Void and a few others are planning to – so a package repository would make it much easier to share my programs, custom patched software, or track bleeding edge releases. I do of course contribute to Void’s official package repository, it’s a bit easier of a process than some other distros (looking at Debian). For a package to be included officially in Void it needs to meet several requirements:
The software should be installed system-wide, not per-user. The software needs to be compiled before being used, even if it is software that is not needed by the whole system. Or another package either within the repository or pending inclusion requires the package. In particular, new themes are highly unlikely to be accepted. Simple shell scripts are unlikely to be accepted unless they provide considerable value to a broad user base. Software need to be used in version announced by authors as ready to use by the general public - usually called releases. Betas, arbitrary VCS revisions, templates using tip of development branch taken at build time and releases created by the package maintainer won’t be accepted.
There are of course exceptions made form time to time, but in general this filters out a lot of things that can’t really be supported by the relatively small Void community. For me personally though I would in fact like to package up my own programs, scripts, and sometimes track packages from their latest git commit.
When you clone the void-packages
repository you first run a command
./xbps binary-bootstrap to setup everything
needed for a local build environment. Then you can run a command like
./xbps-src pkg aerc to build a new package. The package gets placed in
hostdir/binpkgs/ along with a file named something like
(with your CPU architecture instead of course). This folder is your own personal
local repository. The
repodata file stores metadata including a list of all
provided packages. You can build new packages, patch/update exiting ones, and
they will all be placed in here.
If you’re using
xtools to install packages you can actually run
xi aerc while inside the
void-packages repo and it’ll install your local
package rather than looking for one on the internet. Pretty easy and convenient!
To share this local repository with others you need to sign the packages and
then just put that folder on a webserver. Signing them is described here in the
void docs, but you
basically just generate a
PEM key and then start signing all your packages.
People who want to use your repo can create a file in
/etc/xbps.d/. For my
repo I’ve added a file named
20-nilsu.conf which contains this line:
Then, anyone with your repo added will be prompted to accept your key during
their next update and from then on will be able to search for and install your
packages! At this point the repository works perfectly, but to take it a step
further and let my friend push packages I went ahead and created a
repo on sourcehut. Then I wrote a
build.yml file so on every commit sourcehut will spin up a virtual machine,
compile the changed software, sign it, and finally
rsync it to my webserver!
It works pretty great, I’ve packaged up a few new programs and applied a patch to libxft that adds color emoji support. I plan on packaging up all sorts of stuff still.