# TODO: Optimize for znver2
{
  config,
  pkgs,
  nixgl,
  ...
}:
{
  imports = [
    ./roles/2ship2harkinian
    ./roles/ares
    ./roles/dolphin
    ./roles/dont_use_substituters
    ./roles/duckstation
    ./roles/global_options
    ./roles/graphics
    ./roles/pcsx2
    ./roles/rpcs3
    ./roles/ryujinx
    ./roles/shipwright
    ./roles/sm64ex
    ./roles/spaghettikart
    ./roles/steam_rom_manager
    ./roles/yuzu
    ./util/copy_files
    ./util/persist_symlink
    ./util/unfree_polyfill
  ];

  home.username = "deck";
  home.homeDirectory = "/home/deck";
  home.stateVersion = "24.11";

  programs.home-manager.enable = true;

  # enable flakes
  nix = {
    package = pkgs.nix;
    settings.experimental-features = [
      "nix-command"
      "flakes"
    ];
  };
  # Automatic garbage collection
  nix.gc = {
    # Runs nix-collect-garbage --delete-older-than 30d
    automatic = true;
    randomizedDelaySec = "14m";
    options = "--delete-older-than 30d";
  };
  nix.settings.auto-optimise-store = true;

  home.packages = with pkgs; [
    pkgs.nixgl.nixGLIntel
    (pkgs.nixgl.nixGLCommon pkgs.nixgl.nixGLIntel)
    pkgs.nixgl.nixVulkanIntel
  ];

  # This would keep build-time dependencies so I can rebuild while offline.
  # nix.settings = {
  #   keep-outputs = true;
  #   keep-derivations = true;
  # };
}
