Home Explore Blog Models CI



nixpkgs

nixos/modules/services/desktops/flatpak.md
728b948fc1827ee8662b9741ae9210552eb17dc54f6b1fb4000000030000055f
# Flatpak {#module-services-flatpak}

*Source:* {file}`modules/services/desktop/flatpak.nix`

*Upstream documentation:* <https://github.com/flatpak/flatpak/wiki>

Flatpak is a system for building, distributing, and running sandboxed desktop
applications on Linux.

To enable Flatpak, add the following to your {file}`configuration.nix`:
```nix
{ services.flatpak.enable = true; }
```

For the sandboxed apps to work correctly, desktop integration portals need to
be installed. If you run GNOME, this will be handled automatically for you;
in other cases, you will need to add something like the following to your
{file}`configuration.nix`:
```nix
{
  xdg.portal.extraPortals = [ pkgs.xdg-desktop-portal-gtk ];
  xdg.portal.config.common.default = "gtk";
}
```

Then, you will need to add a repository, for example,
[Flathub](https://github.com/flatpak/flatpak/wiki),
either using the following commands:
```ShellSession
$ flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
$ flatpak update
```
or by opening the
[repository file](https://flathub.org/repo/flathub.flatpakrepo) in GNOME Software.

Finally, you can search and install programs:
```ShellSession
$ flatpak search bustle
$ flatpak install flathub org.freedesktop.Bustle
$ flatpak run org.freedesktop.Bustle
```
Again, GNOME Software offers graphical interface for these tasks.

Chunks
67b3e072 (1st chunk of `nixos/modules/services/desktops/flatpak.md`)
Title: Flatpak Setup and Usage
Summary
This document describes how to enable and use Flatpak, a system for sandboxed desktop applications on Linux. To enable Flatpak, set `services.flatpak.enable = true` in your `configuration.nix`. It also outlines the necessity of installing desktop integration portals, which are automatically handled for GNOME users but require manual configuration for others (e.g., `xdg-desktop-portal-gtk`). Finally, it provides instructions on adding Flatpak repositories like Flathub via command line or graphical interfaces, and how to search, install, and run applications using `flatpak` commands or GNOME Software.