Skip to content

Commit

Permalink
common/gpu/intel: reformat
Browse files Browse the repository at this point in the history
  • Loading branch information
Pandapip1 committed Oct 18, 2024
1 parent a8dd1b2 commit 83ebb84
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 56 deletions.
4 changes: 1 addition & 3 deletions common/gpu/intel/comet-lake/default.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
{
imports = [ ../. ];

boot.kernelParams = [
"i915.enable_guc=2"
];
boot.kernelParams = [ "i915.enable_guc=2" ];
}
92 changes: 48 additions & 44 deletions common/gpu/intel/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,54 +6,58 @@
}:
{
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 =
lib.mkEnableOption "Load the Intel GPU kernel module at stage 1 boot. (Added to `boot.initrd.kernelModules`)"
// {
default = true;
options.hardware.intelgpu = {
driver = lib.mkOption {
description = "Intel GPU driver to use";
type = lib.types.enum [
"i915"
"xe"
];
default = "i915";
};

config = {
boot.initrd.kernelModules = lib.optionals config.hardware.intelgpu.loadInInitrd [
config.hardware.intelgpu.driver
];
loadInInitrd =
lib.mkEnableOption "Load the Intel GPU kernel module at stage 1 boot. (Added to `boot.initrd.kernelModules`)"
// {
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
];
config =
let
cfg = config.hardware.intelgpu;
in
{
boot.initrd.kernelModules = lib.optionals cfg.loadInInitrd [ cfg.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
];
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
];

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.";
}
];
};
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.";
}
];
};
}
4 changes: 1 addition & 3 deletions common/gpu/intel/elkhart-lake/default.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
{
imports = [ ../. ];

boot.kernelParams = [
"i915.enable_guc=2"
];
boot.kernelParams = [ "i915.enable_guc=2" ];
}
4 changes: 1 addition & 3 deletions common/gpu/intel/jasper-lake/default.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
{
imports = [ ../. ];

boot.kernelParams = [
"i915.enable_guc=2"
];
boot.kernelParams = [ "i915.enable_guc=2" ];
}
4 changes: 1 addition & 3 deletions common/gpu/intel/sandy-bridge/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,5 @@

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

0 comments on commit 83ebb84

Please sign in to comment.