46 lines
1,023 B
Nix
46 lines
1,023 B
Nix
{
|
|
lib,
|
|
config,
|
|
pkgs,
|
|
...
|
|
}:
|
|
with lib;
|
|
{
|
|
options.hwAccelerationGPU = mkOption {
|
|
type = types.nullOr (
|
|
types.enum [
|
|
"nvidia"
|
|
"intel"
|
|
"amd"
|
|
]
|
|
);
|
|
default = null;
|
|
example = "nvidia";
|
|
description = ''
|
|
The GPU type.
|
|
'';
|
|
};
|
|
|
|
config = {
|
|
boot.kernelParams = mkIf (config.hwAccelerationGPU == "intel") [ "i915.enable_guc=2" ];
|
|
|
|
hardware.opengl = {
|
|
enable = config.hwAccelerationGPU != null;
|
|
driSupport = true;
|
|
driSupport32Bit = true;
|
|
extraPackages = with pkgs; [
|
|
(mkIf (config.hwAccelerationGPU == "intel") intel-media-driver)
|
|
(mkIf (config.hwAccelerationGPU == "intel") intel-compute-runtime)
|
|
];
|
|
};
|
|
|
|
services.xserver.videoDrivers = mkIf (config.hwAccelerationGPU == "nvidia") [ "nvidia" ];
|
|
|
|
hardware.nvidia = mkIf (config.hwAccelerationGPU == "nvidia") {
|
|
modesetting.enable = true;
|
|
open = true;
|
|
package = config.boot.kernelPackages.nvidiaPackages.stable;
|
|
};
|
|
};
|
|
}
|