diff --git a/nixos/doc/manual/configuration/gpu-accel.chapter.md b/nixos/doc/manual/configuration/gpu-accel.chapter.md index 8afa2807b7b60..ff562a24202ef 100644 --- a/nixos/doc/manual/configuration/gpu-accel.chapter.md +++ b/nixos/doc/manual/configuration/gpu-accel.chapter.md @@ -70,16 +70,17 @@ are supported by the Intel NEO OpenCL runtime that is provided by the intel-compute-runtime package. The proprietary Intel OpenCL runtime, in the intel-ocl package, is an alternative for Gen7 GPUs. -The intel-compute-runtime or intel-ocl package can be added to -[](#opt-hardware.graphics.extraPackages) -to enable OpenCL support. For example, for Gen8 and later GPUs, the following -configuration can be used: +Choose your runtime based on your Intel CPU/GPU generation: + +- `intel-compute-runtime`: Since `Broadwell` 5th gen, open source, runs on GPU +- `intel-ocl`: Since `Ivy Bridge` 3rd gen, closed source, deprecated, runs on CPU +- `beignet`: Since `Ivy Bridge` 3rd gen, open source, deprecated, runs on GPU + +i.e. ```nix { - hardware.graphics.extraPackages = [ - intel-compute-runtime - ]; + hardware.intel.opencl.runtime = "intel-compute-runtime"; } ``` diff --git a/nixos/modules/hardware/cpu/intel-opencl.nix b/nixos/modules/hardware/cpu/intel-opencl.nix new file mode 100644 index 0000000000000..73cbb70329d56 --- /dev/null +++ b/nixos/modules/hardware/cpu/intel-opencl.nix @@ -0,0 +1,31 @@ +{ + config, + lib, + pkgs, + ... +}: +{ + options.hardware.intel.opencl.runtime = lib.mkOption { + type = lib.types.nullOr ( + lib.types.enum [ + "intel-compute-runtime" + "intel-ocl" + "beignet" + ] + ); + default = null; + description = '' + Select the Intel OpenCL runtime to use. Choose your runtime based on your Intel CPU/GPU generation. + + - `intel-compute-runtime`: Since `Broadwell` 5th gen, open source, runs on GPU + - `intel-ocl`: Since `Ivy Bridge` 3rd gen, closed source, deprecated, runs on CPU + - `beignet`: Since `Ivy Bridge` 3rd gen, open source, deprecated, runs on GPU + ''; + }; + + config = { + hardware.opengl.extraPackages = lib.mkIf (config.hardware.intel.opencl.runtime != null) [ + pkgs.${config.hardware.intel.opencl.runtime} + ]; + }; +} diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index d412e414f68b5..3adcb714500de 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -56,6 +56,7 @@ ./hardware/cpu/amd-microcode.nix ./hardware/cpu/amd-sev.nix ./hardware/cpu/amd-ryzen-smu.nix + ./hardware/cpu/intel-opencl.nix ./hardware/cpu/intel-microcode.nix ./hardware/cpu/intel-sgx.nix ./hardware/cpu/x86-msr.nix