2 { config, lib, pkgs, ... }:
4 cfg = config.services.flatpak;
8 maintainers = pkgs.flatpak.meta.maintainers;
14 enable = lib.mkEnableOption "flatpak";
16 package = lib.mkPackageOption pkgs "flatpak" { };
22 config = lib.mkIf cfg.enable {
25 { assertion = (config.xdg.portal.enable == true);
26 message = "To use Flatpak you must enable XDG Desktop Portals with xdg.portal.enable.";
30 environment.systemPackages = [ cfg.package ];
32 security.polkit.enable = true;
34 fonts.fontDir.enable = true;
36 services.dbus.packages = [ cfg.package ];
38 systemd.packages = [ cfg.package ];
39 systemd.tmpfiles.packages = [ cfg.package ];
41 environment.profiles = [
42 "$HOME/.local/share/flatpak/exports"
43 "/var/lib/flatpak/exports"
46 # It has been possible since https://github.com/flatpak/flatpak/releases/tag/1.3.2
47 # to build a SELinux policy module.
49 # TODO: use sysusers.d
50 users.users.flatpak = {
51 description = "Flatpak system helper";
56 users.groups.flatpak = { };