marleyos/modules/nixos/nvidia/default.nix

30 lines
574 B
Nix

{
lib,
config,
...
}: let
cfg = config.marleyos.nvidia;
in {
options.marleyos.nvidia.enable = lib.mkEnableOption "nvidia";
config = lib.mkIf cfg.enable {
# NVIDIA drivers are unfree.
nixpkgs.config.allowUnfree = lib.mkForce true;
# Load drivers for Xorg and Wayland.
services.xserver.videoDrivers = ["nvidia"];
hardware = {
# openGL.
graphics.enable = true;
nvidia = {
modesetting.enable = true;
nvidiaSettings = true;
# Disable open-source drivers.
open = false;
};
};
};
}