blob: 8d2f004c4cf10288237980a7eeaf97e4ae375b31 (
plain) (
tree)
|
|
{
config,
options,
lib,
pkgs,
...
}: let
gpuConfig = config.modules.hardware.gpu;
device = config.modules.device;
in {
options.modules.hardware.gpu = {
enable = lib.mkOption {
type = lib.types.bool;
default = true;
};
};
config = lib.mkIf (gpuConfig.enable) (lib.mkMerge [
{
hardware.graphics = {
enable = true;
};
}
(lib.mkIf (device.gpu == "intel") {
boot.initrd.kernelModules = ["i915"];
services.xserver.videoDrivers = ["modesetting"];
hardware.opengl.extraPackages = [
pkgs.intel-compute-runtime
pkgs.intel-media-driver
pkgs.vaapiIntel
pkgs.vaapiVdpau
pkgs.libvdpau-va-gl
];
environment.variables.VDPAU_DRIVER = "va_gl";
})
(lib.mkIf (device.gpu == "nvidia") {
services.xserver.videoDrivers = ["nvidia"];
boot.initrd.kernelModules = [ "nvidia" ];
hardware.nvidia = {
modesetting.enable = true;
powerManagement.enable = false;
powerManagement.finegrained = false;
open = false;
nvidiaSettings = true;
package = config.boot.kernelPackages.nvidiaPackages.latest;
};
environment.systemPackages = with pkgs; [
nvtopPackages.nvidia
];
})
]);
}
|