Skip to main content

Maatuska's Inception

Overview

A tool (or a set of tools) for building (and may be remastering) desktop Linux images from declarative configuration. The goal is to make building desktop Linux images a more predictable and repeatable process. The hope is that using the same configuration would yield almost the same image, and then the image can be updated/remastered by only changing the configuration. It's an ambitious plan but we think it's worth a fighting chance.

caution

At this early stage it feels a lot like reinventing the wheel, but hopefully in the course of developing the concept, some pruning and reuse will happen until hopefully we end up with a genuine value, or just the learning experience.

Thinking something like:

# This is just a naive demo (so far).
# It is using basic Elixir syntax, but the idea could be similar in other
# languages with decent functional programming support, or may be some new
# configuration language.

kernel = Maatuska.kernel("5.10.78")
initramfs = Maatuska.initramfs()
rootfs = Maatuska.rootfs()

[
[kernel, initramfs]
|> Maatuska.volume("FAT32")
|> Maatuska.bootloader(:grub),
[rootfs] |> Maatuska.volume("ext4")
]
|> Maatuska.disk()
|> Maatuska.image("maatuska.img")

and the output would be something like:

Downloading kernel ver 5.10.78 ...
Preparing initramfs, /sbin/init -> busybox ...
Building rootfs based on debian-minbase ...
Building FAT32 volume 03bf0706-b7e9-33b8-aee5-f66c57b895, contents: kernel-5.10.78-image, initramfs-busybox-image
Configuring GRUB on volume-03bf0706-b7e9-33b8-aee5-f66c57b895 ...
Building ext4 volume 03bf0706-b7e9-33b8-aee5-da9e7c5305, contents: debian-minbase
Building GPT disk, volumes: volume-03bf0706-b7e9-33b8-aee5-f66c57b895, volume-03bf0706-b7e9-33b8-aee5-da9e7c5305 ...
Writing disk-101 image to file: maatuska.img ...

Inspirations

Mainly inspired by recent exposure to declarative frameworks and especially prominent Infrastructure as a Code tools, viz. the awesome Terraform by HashiCorp, and another awesome tool Packer by HashiCorp. Among other fancy things, these tools make it very predictable and repeatable to create images and provision infrastructure and they remove the guess work and most of the manual work needed to verify the results. Here are few remarkable moments of inspiration in our journey.

Yocto project

The earliest thought of a tool like Maatuska was inspired by using Yocto project, especially how it is using BitBake recipes. Using Yocto, one can get predictable Linux images using BitBake recipes (may be even a desktop Linux image). However, these recipes tend to get too verbose too quickly, and the tool is not opinionated enough, that best practices are not baked-in rather evolve with time and then they get shared by the community. Also, packages and images are built imperatively and among other things, recipes usually end up having mostly instructions and definitions of things such as setting compiler flags and installing files to specific destinations.

Packer by HashiCorp

Too little we know about all the utilities of this tool, yet it was a key moment when provisioning additional services to an AMI image only required adding few lines to a config file. With all the intricacies of the tool, it is perfectly suited for the cloud. Yet, we could not find an easy way to use it for building a desktop Linux image based on another distro.

Terraform by HashiCorp

This is one of the few truly declarative tools in this list, which codifies cloud APIs and infrastructure into declarative configuration files. It is impressive how Terraform's design and the declarative nature of the configuration files, enable it to detect the changes in state and provision only the required updates to the infrastructure.

Helm Charts and Artifact Hub

The packaging of Kubernetes config files in Helm Charts adds predictability and consistency to the otherwise notoriously complex process of managing Kubernetes clusters. Also, Charts of all sorts of deployments are shared by the community on Artifact Hub, which promotes reuse and makes best practices more accessible.

MX Linux

A relatively old yet robust answer to the desktop Linux remastering needs. The inspiration comes from antiX creative solutions to well known Linux remastering challenges, such as the use of two squashfs files one mounted as root another as home, and all the (no)persistence/frugality/snapshots options it offers.

React (Native), and Flutter

React is one of the earliest tools to demonstrate the benefits of declarative programming. React Native and Flutter are using this approach to create near native performance applications, yet providing a lot simpler development experience. Using these libraries, UI/UX is described declaratively, then elements rendering is handled by the framework. Specifically, the efficient processing of (virtual) element trees using heuristics is relevant to our use case. See React Reconciliation and Inside Flutter.