2024-11-04 22:41:38 -05:00
|
|
|
{ lib, pkgs, config, ... }:
|
2024-10-09 03:36:08 -04:00
|
|
|
{
|
2024-11-04 22:41:38 -05:00
|
|
|
options.system.video = {
|
|
|
|
nvidia = {
|
|
|
|
enable = lib.mkOption {
|
|
|
|
type = lib.types.bool;
|
|
|
|
default = false;
|
|
|
|
description = "Enable the proprietary Nvidia stack";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
nouveau = {
|
|
|
|
enable = lib.mkOption {
|
|
|
|
type = lib.types.bool;
|
|
|
|
default = false;
|
|
|
|
description = "Enable the open-source Nouveau driver";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = {
|
|
|
|
# Conditionally set video drivers based on the options
|
|
|
|
services.xserver.videoDrivers =
|
|
|
|
if config.system.video.nvidia.enable then [ "nvidia" ]
|
|
|
|
else if config.system.video.nouveau.enable then [ "nouveau" ]
|
|
|
|
else [];
|
|
|
|
|
|
|
|
# Configure Nvidia settings if Nvidia is enabled
|
2024-11-18 17:14:02 -05:00
|
|
|
hardware = {
|
|
|
|
nvidia = lib.mkIf config.system.video.nvidia.enable {
|
|
|
|
modesetting.enable = true;
|
|
|
|
nvidiaSettings = false;
|
|
|
|
package = config.boot.kernelPackages.nvidiaPackages.beta;
|
|
|
|
open = false;
|
|
|
|
};
|
|
|
|
opengl.extraPackages = with pkgs; [ nvidia-vaapi-driver ];
|
2024-11-04 22:41:38 -05:00
|
|
|
};
|
2024-10-09 03:36:08 -04:00
|
|
|
};
|
|
|
|
}
|