Skip to content

Building Luft

Day-to-day work happens in test sessions that change nothing on the computer, on Luft itself or on Fedora 45.

Install Bun, Rust and the Sabine CLI, then the build dependencies. On Luft, they become system packages, in one go:

Terminal window
os/dev/dependencies.sh

It installs os/image/packages/build.txt, the compilers and libraries the image’s parts are built with, os/dev/packages.txt, what the virtual machines need, and the packages Fedora builds Mutter with. Some of them bring services or helpers that run as root, so it asks for an administrator’s password once. Like any system package, they update by themselves and are built again for every update of Luft. Packages that already come with Luft are skipped, and any that can’t be added are listed under Installed, Packages in Schelf, with why.

On Fedora 45:

Terminal window
sudo dnf builddep mutter
sudo dnf install $(cat os/image/packages/build.txt os/dev/packages.txt)

Luft itself ships a sabine command at /usr/bin/sabine, the version its apps are built with, which Luft’s updates keep current. When several are on the computer, the newest one runs, so an older ~/.cargo/bin/sabine hands over to the image’s. SABINE_CLI_PINNED=1 keeps a sabine on its own version.

Build Kestrel into kestrel/build and try it in a window:

Terminal window
bun install
kestrel/compositor/build.sh
meson setup kestrel/build kestrel/engine -Dpkg_config_path="$PWD/kestrel/run/mutter-install/lib/pkgconfig" --prefix="$PWD/kestrel/install"
meson compile -C kestrel/build
kestrel/tools/session.sh nested

After pulling, meson compile -C kestrel/build is enough. The nested session copies your wallpaper, settings, keyboard layout and favourite apps, and closing its window ends it.

The TypeScript in kestrel/ui is typed against kestrel/types/gir, generated by ts-for-gir from the GIR files of Kestrel’s own Mutter, its engine and every library they import, so the types match what Kestrel runs, patches included. After changing API the shell uses, in a patch or in the engine, regenerate them:

Terminal window
cd kestrel/types
bun run generate # builds the compositor and kestrel/build first
bun generate.ts --build BUILD_DIR --compositor PREFIX # or uses builds you already have

The image build fails when the checked-in types differ from what its own build produces.

Each app runs from its own folder:

Terminal window
cd apps/system/rover
bun run desktop:dev # the interface with hot reload, in its native window
bun run check # type checks
bun run desktop:build # a release build

Writing a Luft app covers starting a new one, and Testing the test sessions, their modes and what keeps them away from the real system.

Luft’s system is a signed, read-only image, so a build of your own goes over it as a system extension instead of into it. os/dev/layer.sh builds Luft’s parts from your working tree exactly as the image build does, in the same Podman builder, on the same Fedora base as the installed image, and lays them over /usr:

Terminal window
os/dev/layer.sh apply # Kestrel
os/dev/layer.sh apply kestrel app-rover # Kestrel and Rover
os/dev/layer.sh status # what's laid over, from which commit
os/dev/layer.sh reset # back to the signed image
Part Holds
kestrel Kestrel, its settings service, search, the login screen’s service, Luft Keyring and the watchdog
boot trustd, USB protection and Sushi’s shutdown screen
services The installer, updater, system packages, sleep, accounts, speech and Windows services
app-NAME The app called NAME in apps/system or apps/store

Run it on Luft itself, from a clone of this repository; Luft already has the Git and Podman it needs. The first apply downloads the base and sets up the builder, which takes a while and around 8 GB of space; later ones only rebuild what changed. It asks for your password to lay the build over /usr, refreshes the system’s caches, labels everything for SELinux with the installed policy, restarts the system services the build replaces, and reloads D-Bus. Log out and back in to run a new Kestrel or a new session service.

The build stays across restarts. When Luft updates, the next start takes it off and says so, since a build made for the previous version would hide the update’s own files; run apply again to put it back on the new version. It goes over system packages the same way, and both stay merged.

Some things only change with a new image: SELinux policy, Fedora packages the build needs that the image doesn’t have, files in /etc, and whatever runs before the disk is unlocked, such as Sushi and SushiBoot. apply refuses builds that need libraries or typelibs the installed image lacks, and names the files in /etc that differ.

The image is built with Podman, without root:

Terminal window
os/image/build.sh # localhost/luft:45
os/image/build.sh luft-nvidia # localhost/luft:45-nvidia
os/image/build.sh part PART # one part
os/image/build.sh stage PART FOLDER # what one folder installs into its part
os/iso/build.sh # the USB stick, in os/iso/state

The first build downloads Fedora packages, Mutter’s source and the web runtime, and takes about an hour. Later builds only remake the parts whose sources changed, and the web runtime when a newer CEF build comes out: the image ships the CEF build Sabine would install, which os/image/build.sh cef prints and LUFT_CEF pins. Without signing keys, builds make throwaway ones.

os/image/build.sh plan lists them with whether each one needs building. Each is an image named after a hash of what it’s built from, the Fedora image included, so a part is only built again when one of those changes.

Part Holds
kestrel, boot, services Luft’s own programs, as in the table above
assets Luft’s cursors, the Twemoji font, and what the FIDO Alliance says about each model of security key
upstream bootc and xdg-desktop-portal rebuilt from Fedora’s sources with the patches in os/image/patches, and Zypak
runtime Sabine and the web runtime the apps share
helium The Helium browser
store The schelf.store releases the image comes with
app-NAME One app from apps/system
nvidia NVIDIA’s driver, signed for Secure Boot, in the NVIDIA image only

boot and nvidia are signed with the Secure Boot key as they’re built. The assets are made again when the Metadata Service publishes a new list, which each build fetches from Luft’s copy on get.luft.computer.

The apps that need building are built together: one bun install, the Rust they have in common compiled once, then each app in turn, a few at a time, before each becomes a part of its own. The Sabine CLI that builds them and the web runtime is kept as an image too, named after its tag and Fedora’s release, so it’s only built again when Luft moves to a new Sabine.

Every app, service and piece of Kestrel that goes into the image has an image.toml next to it, saying which part it belongs to and what it installs. A part’s build sees only its components’ folders, the crates and workspace: packages they depend on, and the workspace’s manifests and lockfiles. Its cache key hashes those, with only the parts of Cargo.lock and bun.lock the part’s crates and packages reach, so a dependency change elsewhere doesn’t rebuild it. Anything else it reads goes in sources.

part = "services"
sources = ["kestrel/engine/data/emoji.json"]
[cargo]
profile = "release-abort"
[programs]
"/usr/libexec/" = ["updater"]
[files]
"/usr/lib/systemd/system/" = ["data/updater.service", "data/systemd/*.service"]
"/usr/lib/dracut/modules.d/90trustd/" = [{ from = "data/dracut/module-setup.sh", mode = "755" }]
[links]
"/usr/bin/sch" = "schelf"
[enable]
system = ["updater-check.timer"]
user = ["neighbor-notice.service"]
  • part is kestrel, boot, services, assets, or app-NAME for an app, which gets a part of its own. A new part also needs a stage of its own in os/image/parts/Containerfile.
  • programs are built from the folder’s crates and installed with mode 755, files with mode 644. A destination ending in / is a folder. @libexecdir@, @bindir@ and @pamdir@ in installed files become their paths.
  • enable turns units on by default through a preset.
  • Apps install their programs and desktop files through Sabine, so their image.toml only lists units, portals and D-Bus services.

bun os/image/parts/components/check.ts finds include_str!, imports and Meson paths that reach outside a part’s sources, and says what to add.

Disk, boot and install changes are tested in the VMs in os/vm, never on the host’s drives. os/vm/disk.sh installs the image you built onto a virtual disk the way Install Luft does, and SECURE_BOOT=1 os/vm/qemu.sh starts it with Secure Boot and a TPM. Testing apps, services and VMs has the rest.