45 lines
1.2 KiB
Nix
45 lines
1.2 KiB
Nix
{
|
|
lib,
|
|
config,
|
|
pkgs,
|
|
...
|
|
}:
|
|
with lib;
|
|
{
|
|
options.hwAccelerationGPU = mkOption {
|
|
type = types.nullOr (
|
|
types.enum [
|
|
"nvidia"
|
|
"intel"
|
|
"amd"
|
|
]
|
|
);
|
|
default = null;
|
|
example = "nvidia";
|
|
description = ''
|
|
The GPU type.
|
|
'';
|
|
};
|
|
|
|
config = {
|
|
boot.kernelParams = mkIf (config.hwAccelerationGPU == "intel") [ "i915.enable_guc=2" ];
|
|
|
|
hardware.opengl = {
|
|
enable = config.hwAccelerationGPU != null;
|
|
extraPackages = with pkgs; [
|
|
(mkIf (config.hwAccelerationGPU == "intel") intel-media-driver)
|
|
(mkIf (config.hwAccelerationGPU == "intel") intel-compute-runtime)
|
|
(mkIf (config.hwAccelerationGPU == "nvidia") libvdpau-va-gl)
|
|
(mkIf (config.hwAccelerationGPU == "nvidia") vaapiVdpau)
|
|
(mkIf (config.hwAccelerationGPU == "nvidia") vulkan-validation-layers)
|
|
(mkIf (config.hwAccelerationGPU == "nvidia") vulkan-headers)
|
|
(mkIf (config.hwAccelerationGPU == "nvidia") vulkan-caps-viewer)
|
|
(mkIf (config.hwAccelerationGPU == "nvidia") vulkan-extension-layer)
|
|
(mkIf (config.hwAccelerationGPU == "nvidia") vulkan-tools)
|
|
];
|
|
};
|
|
|
|
services.xserver.videoDrivers = mkIf (config.hwAccelerationGPU == "nvidia") [ "nouveau" ];
|
|
};
|
|
}
|