{ lib, config, ... }: let inherit (lib) mkIf mkOption types; in { options.smayzy.flatpak = mkOption { type = types.submodule { options = { enable = mkOption { type = types.bool; default = false; description = "enable flatpak support"; }; gaming.enable = mkOption { type = types.bool; default = false; description = "enable gaming flatpaks"; }; dev.enable = mkOption { type = types.bool; default = false; description = "enable dev flatpaks"; }; utils.enable = mkOption { type = types.bool; default = true; description = "enable utils flatpak"; }; media.enable = mkOption { type = types.bool; default = false; description = "enable media flatpak"; }; }; }; default = { }; }; config = mkIf config.smayzy.flatpak.enable ( let gaming = [ "com.heroicgameslauncher.hgl" ]; dev = [ "com.google.AndroidStudio" ]; utils = [ "com.usebottles.bottles" "com.github.tchx84.Flatseal" "it.mijorus.gearlever" ]; media = [ "com.obsproject.Studio" ]; flatpaks = (if config.smayzy.flatpak.gaming.enable then gaming else [ ]) ++ (if config.smayzy.flatpak.dev.enable then dev else [ ]) ++ (if config.smayzy.flatpak.utils.enable then utils else [ ]) ++ (if config.smayzy.flatpak.media.enable then media else [ ]); in { services.flatpak = { enable = true; update.onActivation = true; packages = flatpaks; }; } ); }