{ pkgs, inputs, nixosConfig, lib, ...}:
let
  cfg = nixosConfig.my.desktop;
in
{
  xdg = {
    enable = true;
    mime.enable = cfg.enable;
    mimeApps.enable = cfg.enable;
    portal = lib.mkIf cfg.enable {
      enable = true;
      extraPortals = [
        pkgs.xdg-desktop-portal-gtk
      ]
      ++ lib.optionalAttrs cfg.hyprland.enable [
        inputs.hyprland.packages.${pkgs.stdenv.hostPlatform.system}.xdg-desktop-portal-hyprland
      ];
      configPackages = []
      ++ lib.optionalAttrs cfg.hyprland.enable [
        inputs.hyprland.packages.${pkgs.stdenv.hostPlatform.system}.hyprland
      ];
    };
  };
}
