1
0
Fork 0
mirror of https://github.com/NixOS/nixos-hardware synced 2024-11-26 21:09:42 +01:00

common/gpu/intel: reformat

This commit is contained in:
Gavin John 2024-10-18 12:38:51 -07:00 committed by mergify[bot]
parent 3827903417
commit 0ccdd27056
5 changed files with 54 additions and 58 deletions

View file

@ -1,7 +1,5 @@
{ {
imports = [ ../. ]; imports = [ ../. ];
boot.kernelParams = [ boot.kernelParams = [ "i915.enable_guc=2" ];
"i915.enable_guc=2"
];
} }

View file

@ -6,54 +6,58 @@
}: }:
{ {
imports = [ ../24.05-compat.nix ]; imports = [ ../24.05-compat.nix ];
options.hardware.intelgpu.driver = lib.mkOption {
description = "Intel GPU driver to use";
type = lib.types.enum [
"i915"
"xe"
];
default = "i915";
};
options.hardware.intelgpu.loadInInitrd = options.hardware.intelgpu = {
lib.mkEnableOption "Load the Intel GPU kernel module at stage 1 boot. (Added to `boot.initrd.kernelModules`)" driver = lib.mkOption {
// { description = "Intel GPU driver to use";
default = true; type = lib.types.enum [
"i915"
"xe"
];
default = "i915";
}; };
config = { loadInInitrd =
boot.initrd.kernelModules = lib.optionals config.hardware.intelgpu.loadInInitrd [ lib.mkEnableOption "Load the Intel GPU kernel module at stage 1 boot. (Added to `boot.initrd.kernelModules`)"
config.hardware.intelgpu.driver // {
]; default = true;
};
hardware.graphics.extraPackages = with pkgs; [
(
if (lib.versionOlder (lib.versions.majorMinor lib.version) "23.11") then
vaapiIntel
else
intel-vaapi-driver.override { enableHybridCodec = true; }
)
intel-media-driver
];
hardware.graphics.extraPackages32 = with pkgs.driversi686Linux; [
(
if (lib.versionOlder (lib.versions.majorMinor lib.version) "23.11") then
vaapiIntel
else
intel-vaapi-driver.override { enableHybridCodec = true; }
)
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.";
}
];
}; };
config =
let
cfg = config.hardware.intelgpu;
in
{
boot.initrd.kernelModules = lib.optionals cfg.loadInInitrd [ cfg.driver ];
hardware.graphics.extraPackages = with pkgs; [
(
if (lib.versionOlder (lib.versions.majorMinor lib.version) "23.11") then
vaapiIntel
else
intel-vaapi-driver.override { enableHybridCodec = true; }
)
intel-media-driver
];
hardware.graphics.extraPackages32 = with pkgs.driversi686Linux; [
(
if (lib.versionOlder (lib.versions.majorMinor lib.version) "23.11") then
vaapiIntel
else
intel-vaapi-driver.override { enableHybridCodec = true; }
)
intel-media-driver
];
assertions = [
{
assertion = (
cfg.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.";
}
];
};
} }

View file

@ -1,7 +1,5 @@
{ {
imports = [ ../. ]; imports = [ ../. ];
boot.kernelParams = [ boot.kernelParams = [ "i915.enable_guc=2" ];
"i915.enable_guc=2"
];
} }

View file

@ -1,7 +1,5 @@
{ {
imports = [ ../. ]; imports = [ ../. ];
boot.kernelParams = [ boot.kernelParams = [ "i915.enable_guc=2" ];
"i915.enable_guc=2"
];
} }

View file

@ -3,7 +3,5 @@
# Enables RC6, RC6p and RC6pp. # Enables RC6, RC6p and RC6pp.
# Last two are only available on Sandy Bridge CPUs (circa 2011). # Last two are only available on Sandy Bridge CPUs (circa 2011).
boot.kernelParams = [ boot.kernelParams = [ "i915.enable_rc6=7" ];
"i915.enable_rc6=7"
];
} }