2023-10-22 17:12:42 +02:00
|
|
|
{ lib, config, pkgs, ... }:
|
|
|
|
with lib;
|
|
|
|
{
|
|
|
|
options.hwAccelerationGPU = mkOption {
|
|
|
|
type = types.nullOr (types.enum [ "nvidia" "intel" ]);
|
|
|
|
default = null;
|
|
|
|
example = "nvidia";
|
|
|
|
description = ''
|
|
|
|
The GPU type.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
config = {
|
2024-02-08 09:59:41 +01:00
|
|
|
boot.kernelParams = mkIf (config.hwAccelerationGPU == "intel") [
|
|
|
|
"i915.enable_guc=2"
|
|
|
|
];
|
|
|
|
|
2023-10-22 17:12:42 +02:00
|
|
|
hardware.opengl = {
|
|
|
|
enable = config.hwAccelerationGPU != null;
|
|
|
|
extraPackages = with pkgs; [
|
2023-11-24 20:16:35 +01:00
|
|
|
(mkIf (config.hwAccelerationGPU == "intel") intel-media-driver)
|
2024-02-08 09:59:41 +01:00
|
|
|
(mkIf (config.hwAccelerationGPU == "intel") intel-compute-runtime)
|
|
|
|
(mkIf (config.hwAccelerationGPU == "nvidia") libvdpau-va-gl)
|
|
|
|
(mkIf (config.hwAccelerationGPU == "nvidia") vaapiVdpau)
|
2024-02-23 22:18:06 +01:00
|
|
|
(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)
|
2023-10-22 17:12:42 +02:00
|
|
|
];
|
|
|
|
};
|
|
|
|
|
|
|
|
services.xserver.videoDrivers = [
|
|
|
|
(mkIf (config.hwAccelerationGPU == "nvidia") "nouveau")
|
|
|
|
];
|
|
|
|
};
|
|
|
|
}
|