2023-02-27 12:59:06 +00:00
|
|
|
{
|
2024-05-20 02:06:05 +00:00
|
|
|
config,
|
|
|
|
lib,
|
|
|
|
pkgs,
|
|
|
|
...
|
|
|
|
}:
|
|
|
|
{
|
2024-06-21 21:26:44 +00:00
|
|
|
imports = [ ../24.05-compat.nix ];
|
2024-05-20 02:06:05 +00:00
|
|
|
options.hardware.intelgpu.driver = lib.mkOption {
|
|
|
|
description = "Intel GPU driver to use";
|
|
|
|
type = lib.types.enum [
|
|
|
|
"i915"
|
|
|
|
"xe"
|
|
|
|
];
|
|
|
|
default = "i915";
|
2023-02-27 12:59:06 +00:00
|
|
|
};
|
|
|
|
|
2024-05-20 02:06:05 +00:00
|
|
|
options.hardware.intelgpu.loadInInitrd =
|
|
|
|
lib.mkEnableOption (
|
|
|
|
lib.mdDoc "Load the Intel GPU kernel module at stage 1 boot. (Added to `boot.initrd.kernelModules`)"
|
|
|
|
)
|
|
|
|
// {
|
|
|
|
default = true;
|
|
|
|
};
|
|
|
|
|
|
|
|
config = {
|
|
|
|
boot.initrd.kernelModules = [ config.hardware.intelgpu.driver ];
|
2024-04-07 19:28:11 +00:00
|
|
|
|
2024-05-20 02:06:05 +00:00
|
|
|
environment.variables = {
|
2024-06-21 13:44:42 +00:00
|
|
|
VDPAU_DRIVER = lib.mkIf config.hardware.graphics.enable (lib.mkDefault "va_gl");
|
2024-05-20 02:06:05 +00:00
|
|
|
};
|
2024-05-14 12:47:54 +00:00
|
|
|
|
2024-06-21 13:44:42 +00:00
|
|
|
hardware.graphics.extraPackages = with pkgs; [
|
2024-05-20 02:06:05 +00:00
|
|
|
(
|
|
|
|
if (lib.versionOlder (lib.versions.majorMinor lib.version) "23.11") then
|
|
|
|
vaapiIntel
|
|
|
|
else
|
|
|
|
intel-vaapi-driver
|
|
|
|
)
|
|
|
|
libvdpau-va-gl
|
|
|
|
intel-media-driver
|
|
|
|
];
|
|
|
|
|
2024-06-21 13:44:42 +00:00
|
|
|
hardware.graphics.extraPackages32 = with pkgs.driversi686Linux; [
|
2024-05-20 02:06:05 +00:00
|
|
|
(
|
|
|
|
if (lib.versionOlder (lib.versions.majorMinor lib.version) "23.11") then
|
|
|
|
vaapiIntel
|
|
|
|
else
|
|
|
|
intel-vaapi-driver
|
|
|
|
)
|
|
|
|
libvdpau-va-gl
|
|
|
|
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 12:59:06 +00:00
|
|
|
}
|