{ pkgs
, lib
, config
, ... }: with lib; let
  gui = with config.global.gpu; enable && session;
  catppuccin = config.home.catppuccin;
in {
  config = {
    users.homeModules = [
      # this module passes gui configuration to home-manager
      { passthrough.gui = gui; }
    ];
    users.adminGroups = mkIf gui [ "video" ];

    # themes and icons
    environment.systemPackages = with pkgs; mkIf gui ([
      papirus-icon-theme
    ] ++ optionals (!catppuccin.enable) [
      whitesur-gtk-theme
      whitesur-icon-theme
      bibata-cursors
    ]);

    fonts.enableDefaultPackages = mkIf gui true;

    security = mkIf gui {
      polkit.enable = true;
    };
    programs = mkIf gui {
      dconf.enable = true;
    };
    services = mkIf gui {
      blueman.enable = !config.global.flatpak.enable;
    };
  };
}
