{ lib, pkgs, config, ... }:
{
  options.system.video.nvidia.enable = lib.mkOption {
    type = lib.types.bool;
    default = false;
  };

  config = lib.mkIf config.system.video.nvidia.enable {
    hardware = {
      nvidia = lib.mkIf config.system.video.nvidia.enable {
        modesetting.enable = true;
        nvidiaSettings = false;
        package = config.boot.kernelPackages.nvidiaPackages.beta;
        open = false;
      };
      graphics.extraPackages = with pkgs; [ nvidia-vaapi-driver ];
    };
    
    boot.kernelParams = [ "nvidia_drm.fbdev=1" ];
    services.xserver.videoDrivers = [ "nvidia" ];
  };
}
