openITCOCKPIT Desktop App - Flatpak Builder • April 7, 2022
Tags: openITCOCKPIT


Since using NixOS in production, the time it takes me to run programs has increased exponentially. (at least that's how it feels)

As a workaround to not having to manually build applications on my system, I've started packaging them as Flatpak when they're not available on the Nix store.

Today it was the turn of the openITCOCKPIT Desktop App.

Some days ago a new version (4.0.5) of the openITCOCKPIT Desktop App was released.

The first update since I left the project in 2020 xD.

In order to be able to use the more powerful, built version and not have to start the app via npm as before, I decided to build the Flatpak version from the zip archive provided by the official download page.

What I did

To create this Flatpak I needed the Flatpak YAML configuration, a package icon file and 3 bash scripts.

1. YAML configuration

I preferred YAML for the manifest file, required by any Flatpak, because it's easier to edit than JSON on the console.

2. build.sh

The build script takes care of installing required Flatpak dependencies, fetching the defined desktop app version and executing the real Flatpak build commands.

Since the zip archive provided by the official download page contains all files directly and not within an extra folder, flatpak-builder had problems to extract some files. The workaround is downloading and extracting the archive in the build.sh script before calling the flatpak-builder.

Since my notebook's SSD is almost always full, I needed a way to let flatpak-builder build when only less than 3% of the total storage is free. With the help of the ostree command I was able to set the minimum required free disk space to 0 for the temporary local repository for building the application.

ostree --repo=./oitcrepo/ config set core.min-free-space-percent 0

3. install.sh

The install.sh is called by the flatpak-builder command to build / install the files in the Flatpak itself. It takes care of the desktop entry creation as well as moving all required files to their right places.

3. run.sh

A --no-sandbox argument is required for the app binary to run the app within the Flatpak (which is already a sandbox). The run.sh is required because arguments can not be added to the manifest command option.

Install the current openITCOCKPIT Desktop App Flatpak version

Automated packaging using GitLab CI

Unfortunately flatpak-builder requires the fuse kernel module, which is not available in an unprivileged docker container used by GitLab CI.

Build it yourself

If you want to use the openITCOCKPIT Desktop App Flatpak version I recommend building the archive yourself. Here's a link to the project repository: https://git.binsky.org/binsky/openitcockpit_desktop_app-flatpak-builder