2023-02-27 13:59:06 +01:00
|
|
|
{
|
2024-05-20 04:06:05 +02:00
|
|
|
config,
|
|
|
|
lib,
|
|
|
|
pkgs,
|
|
|
|
...
|
|
|
|
}:
|
|
|
|
{
|
2024-06-21 23:26:44 +02:00
|
|
|
imports = [ ../24.05-compat.nix ];
|
2024-05-20 04:06:05 +02:00
|
|
|
options.hardware.intelgpu.driver = lib.mkOption {
|
|
|
|
description = "Intel GPU driver to use";
|
|
|
|
type = lib.types.enum [
|
|
|
|
"i915"
|
|
|
|
"xe"
|
|
|
|
];
|
|
|
|
default = "i915";
|
2023-02-27 13:59:06 +01:00
|
|
|
};
|
|
|
|
|
2024-05-20 04:06:05 +02:00
|
|
|
options.hardware.intelgpu.loadInInitrd =
|
2024-08-24 00:59:43 +02:00
|
|
|
lib.mkEnableOption "Load the Intel GPU kernel module at stage 1 boot. (Added to `boot.initrd.kernelModules`)"
|
2024-05-20 04:06:05 +02:00
|
|
|
// {
|
|
|
|
default = true;
|
|
|
|
};
|
|
|
|
|
|
|
|
config = {
|
2024-08-24 00:59:43 +02:00
|
|
|
boot.initrd.kernelModules = lib.optionals config.hardware.intelgpu.loadInInitrd [
|
|
|
|
config.hardware.intelgpu.driver
|
|
|
|
];
|
2024-04-07 21:28:11 +02:00
|
|
|
|
2024-06-21 15:44:42 +02:00
|
|
|
hardware.graphics.extraPackages = with pkgs; [
|
2024-05-20 04:06:05 +02:00
|
|
|
(
|
|
|
|
if (lib.versionOlder (lib.versions.majorMinor lib.version) "23.11") then
|
|
|
|
vaapiIntel
|
|
|
|
else
|
2024-09-30 01:33:55 +02:00
|
|
|
intel-vaapi-driver.override { enableHybridCodec = true; }
|
2024-05-20 04:06:05 +02:00
|
|
|
)
|
|
|
|
intel-media-driver
|
|
|
|
];
|
|
|
|
|
2024-06-21 15:44:42 +02:00
|
|
|
hardware.graphics.extraPackages32 = with pkgs.driversi686Linux; [
|
2024-05-20 04:06:05 +02:00
|
|
|
(
|
|
|
|
if (lib.versionOlder (lib.versions.majorMinor lib.version) "23.11") then
|
|
|
|
vaapiIntel
|
|
|
|
else
|
2024-09-30 01:33:55 +02:00
|
|
|
intel-vaapi-driver.override { enableHybridCodec = true; }
|
2024-05-20 04:06:05 +02:00
|
|
|
)
|
|
|
|
intel-media-driver
|
|
|
|
];
|
|
|
|
|
|
|
|
assertions = [
|
|
|
|
{
|
|
|
|
assertion = (
|
|
|
|
config.hardware.intelgpu.driver != "xe"
|
|
|
|
|| lib.versionAtLeast config.boot.kernelPackages.kernel.version "6.8"
|
|
|
|
);
|
|
|
|
message = "Intel Xe GPU driver is not supported on kernels earlier than 6.8. Update or use the i915 driver.";
|
|
|
|
}
|
|
|
|
];
|
|
|
|
};
|
2023-02-27 13:59:06 +01:00
|
|
|
}
|