{
  pkgs,
  config,
  inputs,
  lib,
  ...
}: let
  cfg = config.mods.flatpak;
in
  with lib; {
    options.mods.flatpak.enable =
      mkEnableOption "enables flatpak programs";

    imports = [
      inputs.nix-flatpak.nixosModules.nix-flatpak
      ./stremio.nix
    ];

    config = mkIf cfg.enable {
      services.flatpak.enable = true;
      xdg.portal.enable = true;
      xdg.portal.extraPortals = [
        pkgs.xdg-desktop-portal
      ];
    };
  }
