> ## Documentation Index
> Fetch the complete documentation index at: https://mintlify.com/electron-userland/electron-builder/llms.txt
> Use this file to discover all available pages before exploring further.

# Flatpak

> Configuration options for building Flatpak bundles with electron-builder

<Warning>
  **Single-file Flatpak bundles**

  Currently `electron-builder` does **not** support publishing apps to Flatpak repositories like [Flathub](https://flathub.org/). This means the Flatpak support in `electron-builder` is limited to generating [single-file bundles](https://docs.flatpak.org/en/latest/single-file-bundles.html) which have various limitations compared to app bundles installed from a repository.

  For what it's worth, there are [some](https://discourse.flathub.org/t/seeking-contractors-for-work-on-flathub-project/1889) [plans](https://discourse.flathub.org/t/is-it-possible-to-publish-a-self-contained-flatpak-file-to-flathub/2083) 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 similarly to the other publishers).
</Warning>

The top-level `flatpak` key contains a set of options instructing electron-builder on how it should build a [Flatpak](https://flatpak.org/) bundle.

<Info>
  **Build dependencies**

  The `flatpak` and `flatpak-builder` packages need to be installed in order to build Flatpak bundles.
</Info>

## 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.

```bash theme={null}
env DEBUG="@malept/flatpak-bundler" electron-builder build --linux flatpak
```

## Configuration

<ParamField path="license" type="string">
  The path to EULA license file. Defaults to `license.txt` or `eula.txt` (or uppercase variants). Only plain text is supported.
</ParamField>

<ParamField path="runtime" type="string">
  The name of the runtime that the application uses.

  See [flatpak manifest documentation](https://docs.flatpak.org/en/latest/flatpak-builder-command-reference.html#flatpak-manifest).

  <Expandable title="default">
    `org.freedesktop.Platform`
  </Expandable>
</ParamField>

<ParamField path="runtimeVersion" type="string">
  The version of the runtime that the application uses.

  See [flatpak manifest documentation](https://docs.flatpak.org/en/latest/flatpak-builder-command-reference.html#flatpak-manifest).

  <Expandable title="default">
    `20.08`
  </Expandable>
</ParamField>

<ParamField path="sdk" type="string">
  The name of the development runtime that the application builds with.

  See [flatpak manifest documentation](https://docs.flatpak.org/en/latest/flatpak-builder-command-reference.html#flatpak-manifest).

  <Expandable title="default">
    `org.freedesktop.Sdk`
  </Expandable>
</ParamField>

<ParamField path="base" type="string">
  Start with the files from the specified application. This can be used to create applications that extend another application.

  See [flatpak manifest documentation](https://docs.flatpak.org/en/latest/flatpak-builder-command-reference.html#flatpak-manifest).

  <Expandable title="default">
    `org.electronjs.Electron2.BaseApp` ([GitHub](https://github.com/flathub/org.electronjs.Electron2.BaseApp))
  </Expandable>
</ParamField>

<ParamField path="baseVersion" type="string">
  Use this specific version of the application specified in base.

  See [flatpak manifest documentation](https://docs.flatpak.org/en/latest/flatpak-builder-command-reference.html#flatpak-manifest).

  <Expandable title="default">
    `20.08`
  </Expandable>
</ParamField>

<ParamField path="branch" type="string">
  The branch to use when exporting the application.

  See [flatpak manifest documentation](https://docs.flatpak.org/en/latest/flatpak-builder-command-reference.html#flatpak-manifest).

  <Expandable title="default">
    `master`
  </Expandable>
</ParamField>

<ParamField path="finishArgs" type="string[]">
  An array of arguments passed to the flatpak build-finish command.

  See [flatpak manifest documentation](https://docs.flatpak.org/en/latest/flatpak-builder-command-reference.html#flatpak-manifest).

  <Expandable title="default">
    ```json theme={null}
    [
      // 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",
    ]
    ```
  </Expandable>
</ParamField>

<ParamField path="modules" type="Array<string | any>">
  An array of objects specifying the modules to be built in order.

  See [flatpak manifest documentation](https://docs.flatpak.org/en/latest/flatpak-builder-command-reference.html#flatpak-manifest).
</ParamField>

<ParamField path="files" type="Array<[string, string]>">
  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/).

  See [@malept/flatpak-bundler documentation](https://github.com/malept/flatpak-bundler#build-options).
</ParamField>

<ParamField path="symlinks" type="Array<[string, string]>">
  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.

  See [@malept/flatpak-bundler documentation](https://github.com/malept/flatpak-bundler#build-options).
</ParamField>

<ParamField path="useWaylandFlags" type="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.

  <Expandable title="default">
    `false`
  </Expandable>
</ParamField>

<ParamField path="synopsis" type="string">
  The [short description](https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Description).
</ParamField>

<ParamField path="description" type="string">
  As [description](/configuration#description) from application package.json, but allows you to specify different for Linux.
</ParamField>

<ParamField path="category" type="string">
  The [application category](https://specifications.freedesktop.org/menu-spec/latest/apa.html#main-category-registry).
</ParamField>

<ParamField path="mimeTypes" type="string[]">
  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.
</ParamField>

<ParamField path="desktop" type="LinuxDesktopFile">
  The [Desktop file](https://developer.gnome.org/documentation/guidelines/maintainer/integrating.html#desktop-files)
</ParamField>

<ParamField path="executableArgs" type="string[]">
  The executable parameters. Pass to executableName
</ParamField>
