Flatpak
Single-file Flatpak bundles
Currently electron-builder
does not support publishing apps to Flatpak repositories like Flathub. This means the Flatpak support in electron-builder
is limited to generating single-file bundles which have various limitations compared to app bundles installed from a repository.
For what it’s worth, there are some plans to make it easier to publish Electron apps to Flathub. When that happens, it should be easier to create a Flathub publisher for electron-builder
(which would work similary to the other publishers).
The top-level flatpak key contains a set of options instructing electron-builder on how it should build a Flatpak bundle.
Build dependencies
The flatpak
and flatpak-builder
packages need to be installed in order to build Flatpak bundles.
-
license
String | “undefined” - The path to EULA license file. Defaults tolicense.txt
oreula.txt
(or uppercase variants). Only plain text is supported. -
runtime
String - The name of the runtime that the application uses. Defaults toorg.freedesktop.Platform
. -
runtimeVersion
String - The version of the runtime that the application uses. Defaults to20.08
. -
sdk
String - The name of the development runtime that the application builds with. Defaults toorg.freedesktop.Sdk
. -
base
String - Start with the files from the specified application. This can be used to create applications that extend another application. Defaults to org.electronjs.Electron2.BaseApp. -
baseVersion
String - Use this specific version of the application specified in base. Defaults to20.08
. -
branch
String - The branch to use when exporting the application. Defaults tomaster
. -
finishArgs
Array<String> - An array of arguments passed to the flatpak build-finish command. Defaults to:json [ // Wayland/X11 Rendering "--socket=wayland", "--socket=x11", "--share=ipc", // Open GL "--device=dri", // Audio output "--socket=pulseaudio", // Read/write home directory access "--filesystem=home", // Allow communication with network "--share=network", // System notifications with libnotify "--talk-name=org.freedesktop.Notifications", ]
-
modules
Array<any> - An array of objects specifying the modules to be built in order. -
files
Array - Files to copy directly into the app. Should be a list of [source, dest] tuples. Source should be a relative/absolute path to a file/directory to copy into the flatpak, and dest should be the path inside the app install prefix (e.g. /share/applications/). -
symlinks
Array - Symlinks to create in the app files. Should be a list of [target, location] symlink tuples. Target can be either a relative or absolute path inside the app install prefix, and location should be a absolute path inside the prefix to create the symlink at. -
useWaylandFlags
Boolean - Whether to enable the Wayland specific flags (--enable-features=UseOzonePlatform --ozone-platform=wayland
) in the wrapper script. These flags are only available starting with Electron version 12. Defaults tofalse
.
Inherited from CommonLinuxOptions
:
synopsis
String | “undefined” - The short description.description
String | “undefined” - As description from application package.json, but allows you to specify different for Linux.category
String | “undefined” - The application category.mimeTypes
Array<String> | “undefined” - The mime types in addition to specified in the file associations. Use it if you don’t want to register a new mime type, but reuse existing.desktop
any | “undefined” - The Desktop file entries (name to value).executableArgs
Array<String> | “undefined” - The executable parameters. Pass to executableName
Inherited from TargetSpecificOptions
:
artifactName
String | “undefined” - The artifact file name template.publish
The publish options.
Troubleshooting¶
If the Flatpak build process fails with an error message like “flatpak failed with status code X”, setting the DEBUG="@malept/flatpak-bundler"
environment variable should provide more context about the error.
Enable Flatpak build debug logging
env DEBUG="@malept/flatpak-bundler" electron-builder build --linux flatpak