NixOS-Config/modules/system/devices/video/nvidia/default.nix

36 lines
1.2 KiB
Nix
Raw Normal View History

{ lib, pkgs, config, ... }:
2024-10-09 03:36:08 -04: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
hardware.nvidia = lib.mkIf config.system.video.nvidia.enable {
modesetting.enable = true;
nvidiaSettings = false;
package = config.boot.kernelPackages.nvidiaPackages.beta;
open = false;
};
2024-10-09 03:36:08 -04:00
};
}