2024-04-11 20:15:47 +02:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
config,
|
|
|
|
pkgs,
|
|
|
|
...
|
|
|
|
}:
|
2023-10-22 17:12:42 +02:00
|
|
|
with lib;
|
|
|
|
{
|
|
|
|
options.hwAccelerationGPU = mkOption {
|
2024-04-11 20:15:47 +02:00
|
|
|
type = types.nullOr (
|
|
|
|
types.enum [
|
|
|
|
"nvidia"
|
|
|
|
"intel"
|
|
|
|
"amd"
|
|
|
|
]
|
|
|
|
);
|
2023-10-22 17:12:42 +02:00
|
|
|
default = null;
|
|
|
|
example = "nvidia";
|
|
|
|
description = ''
|
|
|
|
The GPU type.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
config = {
|
2024-04-11 20:15:47 +02:00
|
|
|
boot.kernelParams = mkIf (config.hwAccelerationGPU == "intel") [ "i915.enable_guc=2" ];
|
2024-02-08 09:59:41 +01:00
|
|
|
|
2023-10-22 17:12:42 +02:00
|
|
|
hardware.opengl = {
|
|
|
|
enable = config.hwAccelerationGPU != null;
|
2024-04-22 13:05:52 +02:00
|
|
|
driSupport = true;
|
|
|
|
driSupport32Bit = true;
|
2023-10-22 17:12:42 +02:00
|
|
|
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)
|
2023-10-22 17:12:42 +02:00
|
|
|
];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|