{
  config,
  inputs,
  lib,
  pkgs,
  ...
}: let
  cfg = config.hive.programs.games;
in {
  options.hive.programs.games = {
    enable = lib.mkEnableOption "Enable the games module";
    steam = lib.mkOption {
      type = lib.types.bool;
      default = false;
      description = ''
        Enable Steam support.
      '';
    };
    dayz = lib.mkOption {
      type = lib.types.bool;
      default = false;
      description = ''
        Enable DayZ tools.
      '';
    };
    lutris = lib.mkOption {
      type = lib.types.bool;
      default = false;
      description = ''
        Enable Lutris support.
      '';
    };
    r2modman = lib.mkOption {
      type = lib.types.bool;
      default = false;
      description = ''
        Enable R2ModMan support.
      '';
    };
    wine = lib.mkOption {
      type = lib.types.bool;
      default = false;
      description = ''
        Enable Wine support.
      '';
    };
  };

  config = lib.mkIf cfg.enable {
    environment.systemPackages =
      lib.optional cfg.lutris
      (pkgs.lutris.override {
        extraPkgs = pkgs: [
          pkgs.libnghttp2
          pkgs.winetricks
        ];
      })
      ++ lib.optional cfg.r2modman pkgs.r2modman
      ++ lib.optionals cfg.dayz [
        pkgs.hive.crossover
        inputs.dzgui-nix.packages.${pkgs.stdenv.system}.default
      ]
      ++ lib.optionals cfg.wine [
        pkgs.wine
        pkgs.winetricks
      ]
      ++ lib.optional (cfg.steam && cfg.wine) pkgs.proton-caller;

    programs.steam = lib.mkIf cfg.steam {
      enable = true;
      gamescopeSession.enable = true;
    };
  };
}
