{ pkgs
, lib
, config
, ... }: with lib; let
  cfg = config.home.util;
  gui = with config.global.gpu; enable && session;
in {
  options.home.util = {
    minimal = mkEnableOption "minimal system environment with less packages";
  };

  config = {
    users.homeModules = [
      # this module passes util configuration to home-manager
      { passthrough.util = cfg; }
      # this module passes flatpak configuration to home-manager
      { passthrough.flatpak = config.global.flatpak; }
    ];

    programs.zsh.enable = true;
    environment.shells = singleton pkgs.zsh;

    users.home.persist.directories = [ ] ++
    optionals (!cfg.minimal) [
      ".cache/nix-index"
    ] ++
    optionals gui [
      # jellyfin-media-player
      ".config/jellyfin.org"
      ".local/share/jellyfinmediaplayer"
      ".local/share/Jellyfin Media Player"
      # mission-planner
      ".local/share/Mission Planner"
      # expresslrs-configurator
      ".config/ExpressLRS Configurator"
      # betaflight-configurator
      ".config/betaflight-configurator"
      # inav-configurator
      ".config/inav-configurator"
    ];
  };
}
