{ config, lib, pkgs, inputs, ... }:

# Launch options: -novid -nojoy -nosteamcontroller -nohltv -particles 1 -precachefontchars -noquicktime -console -windowed -noborder

let cfg = config.sydnix.users.crumb.tf2;
in {
  options.sydnix.users.crumb.tf2 = {
    enable = lib.mkEnableOption "Madeleine's Team Fortress 2 config";
  };

  config = lib.mkIf cfg.enable
    (let
      tf2pkgs = inputs.tf2-nix.packages.x86_64-linux;
      my-config = tf2pkgs.mergeTf2Configs (with tf2pkgs; [
          mastercomfig.presets.medium-low
          mastercomfig.addons.flat-mouse
          mastercomfig.addons.no-tutorial
          mastercomfig.addons.null-canceling-movement
          # improved-crosshairs
          ./tf2/improved-crosshairs-0.1.1
          loadouts-script
          (huds.deerhud.overrideAttrs (final: prev: {
            patches = [ ./tf2/raise-uber-meter.patch ];
          }))
          maps.jump_noskillrequired_b3
          ./tf2/my-config
          ./tf2/quake-hitsounds
        ]);
      game-dir = ".local/share/Steam/steamapps/common/Team Fortress 2/tf";
    in {
      home.file.${game-dir} = {
        recursive = true;
        source = my-config;
      };
  });
}
