diff --git a/nixos/doc/manual/configuration/gpu-accel.chapter.md b/nixos/doc/manual/configuration/gpu-accel.chapter.md
index 835cbad554859..c6030292a67e5 100644
--- a/nixos/doc/manual/configuration/gpu-accel.chapter.md
+++ b/nixos/doc/manual/configuration/gpu-accel.chapter.md
@@ -30,7 +30,7 @@ $ export \
```
The second mechanism is to add the OpenCL driver package to
-[](#opt-hardware.opengl.extraPackages).
+[](options.html#opt-hardware.drivers.packages).
This links the ICD file under `/run/opengl-driver`, where it will be visible
to the ICD loader.
@@ -51,11 +51,11 @@ Platform Vendor Advanced Micro Devices, Inc.
Modern AMD [Graphics Core
Next](https://en.wikipedia.org/wiki/Graphics_Core_Next) (GCN) GPUs are
supported through the rocm-opencl-icd package. Adding this package to
-[](#opt-hardware.opengl.extraPackages)
+[](options.html#opt-hardware.drivers.packages)
enables OpenCL support:
```nix
-hardware.opengl.extraPackages = [
+hardware.drivers.packages = [
rocm-opencl-icd
];
```
@@ -71,12 +71,12 @@ proprietary Intel OpenCL runtime, in the intel-ocl package, is an
alternative for Gen7 GPUs.
The intel-compute-runtime, beignet, or intel-ocl package can be added to
-[](#opt-hardware.opengl.extraPackages)
+[](options.html#opt-hardware.drivers.packages)
to enable OpenCL support. For example, for Gen8 and later GPUs, the following
configuration can be used:
```nix
-hardware.opengl.extraPackages = [
+hardware.drivers.packages = [
intel-compute-runtime
];
```
@@ -88,9 +88,6 @@ compute API for GPUs. It is used directly by games or indirectly though
compatibility layers like
[DXVK](https://github.com/doitsujin/dxvk/wiki).
-By default, if [](#opt-hardware.opengl.driSupport)
-is enabled, mesa is installed and provides Vulkan for supported hardware.
-
Similar to OpenCL, Vulkan drivers are loaded through the *Installable
Client Driver* (ICD) mechanism. ICD files for Vulkan are JSON files that
specify the path to the driver library and the supported Vulkan version.
@@ -108,7 +105,7 @@ $ export \
```
The second mechanism is to add the Vulkan driver package to
-[](#opt-hardware.opengl.extraPackages).
+[](options.html#opt-hardware.drivers.packages).
This links the ICD file under `/run/opengl-driver`, where it will be
visible to the ICD loader.
@@ -138,17 +135,17 @@ Modern AMD [Graphics Core
Next](https://en.wikipedia.org/wiki/Graphics_Core_Next) (GCN) GPUs are
supported through either radv, which is part of mesa, or the amdvlk
package. Adding the amdvlk package to
-[](#opt-hardware.opengl.extraPackages)
+[](options.html#opt-hardware.drivers.packages)
makes amdvlk the default driver and hides radv and lavapipe from the device list.
A specific driver can be forced as follows:
```nix
-hardware.opengl.extraPackages = [
+hardware.drivers.packages = [
pkgs.amdvlk
];
# To enable Vulkan support for 32-bit applications, also add:
-hardware.opengl.extraPackages32 = [
+hardware.drivers.packages32 = [
pkgs.driversi686Linux.amdvlk
];
diff --git a/nixos/doc/manual/configuration/x-windows.chapter.md b/nixos/doc/manual/configuration/x-windows.chapter.md
index 27d117238807b..67b818a8a9459 100644
--- a/nixos/doc/manual/configuration/x-windows.chapter.md
+++ b/nixos/doc/manual/configuration/x-windows.chapter.md
@@ -12,7 +12,7 @@ driver from a set of X.org drivers (such as `vesa` and `intel`). You can
also specify a driver manually, e.g.
```nix
-services.xserver.videoDrivers = [ "r128" ];
+hardware.gpu.drivers = [ "r128" ];
```
to enable X.org's `xf86-video-r128` driver.
@@ -66,7 +66,7 @@ On 64-bit systems, if you want OpenGL for 32-bit programs such as in
Wine, you should also set the following:
```nix
-hardware.opengl.driSupport32Bit = true;
+hardware.drivers.enable32bit = true;
```
## Auto-login {#sec-x11-auto-login .unnumbered}
@@ -115,18 +115,18 @@ officially updated since 2015.
The results vary depending on the hardware, so you may have to try both
drivers. Use the option
-[](#opt-services.xserver.videoDrivers)
+[](#opt-hardware.gpu.drivers)
to set one. The recommended configuration for modern systems is:
```nix
-services.xserver.videoDrivers = [ "modesetting" ];
+hardware.gpu.drivers = [ "modesetting" ];
```
If you experience screen tearing no matter what, this configuration was
reported to resolve the issue:
```nix
-services.xserver.videoDrivers = [ "intel" ];
+hardware.gpu.drivers = [ "intel" ];
services.xserver.deviceSection = ''
Option "DRI" "2"
Option "TearFree" "true"
@@ -143,16 +143,16 @@ better 3D performance than the X.org drivers. It is not enabled by
default because it's not free software. You can enable it as follows:
```nix
-services.xserver.videoDrivers = [ "nvidia" ];
+hardware.gpu.drivers = [ "nvidia" ];
```
Or if you have an older card, you may have to use one of the legacy
drivers:
```nix
-services.xserver.videoDrivers = [ "nvidiaLegacy390" ];
-services.xserver.videoDrivers = [ "nvidiaLegacy340" ];
-services.xserver.videoDrivers = [ "nvidiaLegacy304" ];
+hardware.gpu.drivers = [ "nvidiaLegacy390" ];
+hardware.gpu.drivers = [ "nvidiaLegacy340" ];
+hardware.gpu.drivers = [ "nvidiaLegacy304" ];
```
You may need to reboot after enabling this driver to prevent a clash
@@ -167,7 +167,7 @@ performance. If you still want to use it anyway, you need to explicitly
set:
```nix
-services.xserver.videoDrivers = [ "amdgpu-pro" ];
+hardware.gpu.drivers = [ "amdgpu-pro" ];
```
You will need to reboot after enabling this driver to prevent a clash
diff --git a/nixos/doc/manual/from_md/configuration/gpu-accel.chapter.xml b/nixos/doc/manual/from_md/configuration/gpu-accel.chapter.xml
index cc559a1933d92..83dff00c7465f 100644
--- a/nixos/doc/manual/from_md/configuration/gpu-accel.chapter.xml
+++ b/nixos/doc/manual/from_md/configuration/gpu-accel.chapter.xml
@@ -36,9 +36,10 @@ $ export \
The second mechanism is to add the OpenCL driver package to
- . This links
- the ICD file under /run/opengl-driver, where it
- will be visible to the ICD loader.
+ .
+ This links the ICD file under
+ /run/opengl-driver, where it will be visible to
+ the ICD loader.
The proper installation of OpenCL drivers can be verified through
@@ -59,11 +60,11 @@ Platform Vendor Advanced Micro Devices, Inc.
Graphics
Core Next (GCN) GPUs are supported through the
rocm-opencl-icd package. Adding this package to
- enables
- OpenCL support:
+
+ enables OpenCL support:
-hardware.opengl.extraPackages = [
+hardware.drivers.packages = [
rocm-opencl-icd
];
@@ -81,12 +82,13 @@ hardware.opengl.extraPackages = [
The intel-compute-runtime, beignet, or intel-ocl package can be
- added to to
- enable OpenCL support. For example, for Gen8 and later GPUs, the
- following configuration can be used:
+ added to
+
+ to enable OpenCL support. For example, for Gen8 and later GPUs,
+ the following configuration can be used:
-hardware.opengl.extraPackages = [
+hardware.drivers.packages = [
intel-compute-runtime
];
@@ -100,11 +102,6 @@ hardware.opengl.extraPackages = [
games or indirectly though compatibility layers like
DXVK.
-
- By default, if
- is enabled, mesa is installed and provides Vulkan for supported
- hardware.
-
Similar to OpenCL, Vulkan drivers are loaded through the
Installable Client Driver (ICD) mechanism.
@@ -126,9 +123,10 @@ $ export \
The second mechanism is to add the Vulkan driver package to
- . This links
- the ICD file under /run/opengl-driver, where it
- will be visible to the ICD loader.
+ .
+ This links the ICD file under
+ /run/opengl-driver, where it will be visible to
+ the ICD loader.
The proper installation of Vulkan drivers can be verified through
@@ -158,17 +156,18 @@ GPU1:
Graphics
Core Next (GCN) GPUs are supported through either radv,
which is part of mesa, or the amdvlk package. Adding the amdvlk
- package to
+ package to
+
makes amdvlk the default driver and hides radv and lavapipe from
the device list. A specific driver can be forced as follows:
-hardware.opengl.extraPackages = [
+hardware.drivers.packages = [
pkgs.amdvlk
];
# To enable Vulkan support for 32-bit applications, also add:
-hardware.opengl.extraPackages32 = [
+hardware.drivers.packages32 = [
pkgs.driversi686Linux.amdvlk
];
diff --git a/nixos/doc/manual/from_md/configuration/x-windows.chapter.xml b/nixos/doc/manual/from_md/configuration/x-windows.chapter.xml
index c17e98983b27d..74ac88a1e9c33 100644
--- a/nixos/doc/manual/from_md/configuration/x-windows.chapter.xml
+++ b/nixos/doc/manual/from_md/configuration/x-windows.chapter.xml
@@ -14,7 +14,7 @@ services.xserver.enable = true;
manually, e.g.
-services.xserver.videoDrivers = [ "r128" ];
+hardware.gpu.drivers = [ "r128" ];
to enable X.org’s xf86-video-r128 driver.
@@ -71,7 +71,7 @@ services.xserver.autorun = false;
Wine, you should also set the following:
-hardware.opengl.driSupport32Bit = true;
+hardware.drivers.enable32bit = true;
Auto-login
@@ -128,18 +128,18 @@ services.xserver.displayManager.autoLogin.user = "alice";
The results vary depending on the hardware, so you may have to try
both drivers. Use the option
- to set one.
- The recommended configuration for modern systems is:
+ to set one. The
+ recommended configuration for modern systems is:
-services.xserver.videoDrivers = [ "modesetting" ];
+hardware.gpu.drivers = [ "modesetting" ];
If you experience screen tearing no matter what, this
configuration was reported to resolve the issue:
-services.xserver.videoDrivers = [ "intel" ];
+hardware.gpu.drivers = [ "intel" ];
services.xserver.deviceSection = ''
Option "DRI" "2"
Option "TearFree" "true"
@@ -160,16 +160,16 @@ services.xserver.deviceSection = ''
it as follows:
-services.xserver.videoDrivers = [ "nvidia" ];
+hardware.gpu.drivers = [ "nvidia" ];
Or if you have an older card, you may have to use one of the
legacy drivers:
-services.xserver.videoDrivers = [ "nvidiaLegacy390" ];
-services.xserver.videoDrivers = [ "nvidiaLegacy340" ];
-services.xserver.videoDrivers = [ "nvidiaLegacy304" ];
+hardware.gpu.drivers = [ "nvidiaLegacy390" ];
+hardware.gpu.drivers = [ "nvidiaLegacy340" ];
+hardware.gpu.drivers = [ "nvidiaLegacy304" ];
You may need to reboot after enabling this driver to prevent a
@@ -186,7 +186,7 @@ services.xserver.videoDrivers = [ "nvidiaLegacy304" ];
need to explicitly set:
-services.xserver.videoDrivers = [ "amdgpu-pro" ];
+hardware.gpu.drivers = [ "amdgpu-pro" ];
You will need to reboot after enabling this driver to prevent a
diff --git a/nixos/doc/manual/from_md/release-notes/rl-1603.section.xml b/nixos/doc/manual/from_md/release-notes/rl-1603.section.xml
index 172b800b5992f..6f082170e8de6 100644
--- a/nixos/doc/manual/from_md/release-notes/rl-1603.section.xml
+++ b/nixos/doc/manual/from_md/release-notes/rl-1603.section.xml
@@ -506,9 +506,8 @@ nginx.override {
services.xserver.vaapiDrivers has been
- removed. Use
- hardware.opengl.extraPackages{,32} instead.
- You can also specify VDPAU drivers there.
+ removed. Use hardware.drivers.packages{,32}
+ instead. You can also specify VDPAU drivers there.
diff --git a/nixos/doc/manual/from_md/release-notes/rl-1903.section.xml b/nixos/doc/manual/from_md/release-notes/rl-1903.section.xml
index f26e68e132000..d8da45294b445 100644
--- a/nixos/doc/manual/from_md/release-notes/rl-1903.section.xml
+++ b/nixos/doc/manual/from_md/release-notes/rl-1903.section.xml
@@ -746,7 +746,7 @@
The intel driver has been removed from the
default list of
- X.org
+ X.org
video drivers. The modesetting
driver should take over automatically, it is better maintained
upstream and has less problems with advanced X11 features.
diff --git a/nixos/doc/manual/from_md/release-notes/rl-2009.section.xml b/nixos/doc/manual/from_md/release-notes/rl-2009.section.xml
index edebd92b327a6..93fb6447c72a8 100644
--- a/nixos/doc/manual/from_md/release-notes/rl-2009.section.xml
+++ b/nixos/doc/manual/from_md/release-notes/rl-2009.section.xml
@@ -2076,14 +2076,14 @@ CREATE ROLE postgres LOGIN SUPERUSER;
For AMD GPUs, Vulkan can now be used by adding
amdvlk to
- hardware.opengl.extraPackages.
+ hardware.drivers.packages.
Similarly, still for AMD GPUs, the ROCm OpenCL stack can now
be used by adding rocm-opencl-icd to
- hardware.opengl.extraPackages.
+ hardware.drivers.packages.
diff --git a/nixos/doc/manual/from_md/release-notes/rl-2105.section.xml b/nixos/doc/manual/from_md/release-notes/rl-2105.section.xml
index fb11b19229e28..35990e1c0175f 100644
--- a/nixos/doc/manual/from_md/release-notes/rl-2105.section.xml
+++ b/nixos/doc/manual/from_md/release-notes/rl-2105.section.xml
@@ -810,7 +810,7 @@ self: super:
- services.xserver.videoDrivers
+ hardware.gpu.drivers
no longer uses the deprecated cirrus and
vesa device dependent X drivers by default.
It also enables both amdgpu and
diff --git a/nixos/doc/manual/release-notes/rl-1603.section.md b/nixos/doc/manual/release-notes/rl-1603.section.md
index dce879ec16d07..bae83093a5d25 100644
--- a/nixos/doc/manual/release-notes/rl-1603.section.md
+++ b/nixos/doc/manual/release-notes/rl-1603.section.md
@@ -182,7 +182,7 @@ When upgrading from a previous release, please be aware of the following incompa
There are also Gutenprint improvements; in particular, a new option `services.printing.gutenprint` is added to enable automatic updating of Gutenprint PPMs; it\'s greatly recommended to enable it instead of adding `gutenprint` to the `drivers` list.
-- `services.xserver.vaapiDrivers` has been removed. Use `hardware.opengl.extraPackages{,32}` instead. You can also specify VDPAU drivers there.
+- `services.xserver.vaapiDrivers` has been removed. Use `hardware.drivers.packages{,32}` instead. You can also specify VDPAU drivers there.
- `programs.ibus` moved to `i18n.inputMethod.ibus`. The option `programs.ibus.plugins` changed to `i18n.inputMethod.ibus.engines` and the option to enable ibus changed from `programs.ibus.enable` to `i18n.inputMethod.enabled`. `i18n.inputMethod.enabled` should be set to the used input method name, `"ibus"` for ibus. An example of the new style:
diff --git a/nixos/doc/manual/release-notes/rl-1903.section.md b/nixos/doc/manual/release-notes/rl-1903.section.md
index 7637a70c1bf8b..345b4cbd9d29f 100644
--- a/nixos/doc/manual/release-notes/rl-1903.section.md
+++ b/nixos/doc/manual/release-notes/rl-1903.section.md
@@ -205,7 +205,7 @@ When upgrading from a previous release, please be aware of the following incompa
- The kubernetes module does no longer add the kubernetes package to `environment.systemPackages` implicitly.
-- The `intel` driver has been removed from the default list of [X.org video drivers](options.html#opt-services.xserver.videoDrivers). The `modesetting` driver should take over automatically, it is better maintained upstream and has less problems with advanced X11 features. This can lead to a change in the output names used by `xrandr`. Some performance regressions on some GPU models might happen. Some OpenCL and VA-API applications might also break (Beignet seems to provide OpenCL support with `modesetting` driver, too). Kernel mode setting API does not support backlight control, so `xbacklight` tool will not work; backlight level can be controlled directly via `/sys/` or with `brightnessctl`. Users who need this functionality more than multi-output XRandR are advised to add \`intel\` to \`videoDrivers\` and report an issue (or provide additional details in an existing one)
+- The `intel` driver has been removed from the default list of [X.org video drivers](options.html#opt-hardware.gpu.drivers). The `modesetting` driver should take over automatically, it is better maintained upstream and has less problems with advanced X11 features. This can lead to a change in the output names used by `xrandr`. Some performance regressions on some GPU models might happen. Some OpenCL and VA-API applications might also break (Beignet seems to provide OpenCL support with `modesetting` driver, too). Kernel mode setting API does not support backlight control, so `xbacklight` tool will not work; backlight level can be controlled directly via `/sys/` or with `brightnessctl`. Users who need this functionality more than multi-output XRandR are advised to add \`intel\` to \`videoDrivers\` and report an issue (or provide additional details in an existing one)
- Openmpi has been updated to version 4.0.0, which removes some deprecated MPI-1 symbols. This may break some older applications that still rely on those symbols. An upgrade guide can be found [here](https://www.open-mpi.org/faq/?category=mpi-removed).
diff --git a/nixos/doc/manual/release-notes/rl-2009.section.md b/nixos/doc/manual/release-notes/rl-2009.section.md
index 79be2a56a54eb..332e5b299e4e6 100644
--- a/nixos/doc/manual/release-notes/rl-2009.section.md
+++ b/nixos/doc/manual/release-notes/rl-2009.section.md
@@ -696,9 +696,9 @@ When upgrading from a previous release, please be aware of the following incompa
- Kubernetes has been upgraded to 1.19.1, which also means that the golang version to build it has been bumped to 1.15. This may have consequences for your existing clusters and their certificates. Please consider [ the release notes for Kubernetes 1.19 carefully ](https://relnotes.k8s.io/?markdown=93264) before upgrading.
-- For AMD GPUs, Vulkan can now be used by adding `amdvlk` to `hardware.opengl.extraPackages`.
+- For AMD GPUs, Vulkan can now be used by adding `amdvlk` to `hardware.drivers.packages`.
-- Similarly, still for AMD GPUs, the ROCm OpenCL stack can now be used by adding `rocm-opencl-icd` to `hardware.opengl.extraPackages`.
+- Similarly, still for AMD GPUs, the ROCm OpenCL stack can now be used by adding `rocm-opencl-icd` to `hardware.drivers.packages`.
## Contributions {#sec-release-20.09-contributions}
diff --git a/nixos/doc/manual/release-notes/rl-2105.section.md b/nixos/doc/manual/release-notes/rl-2105.section.md
index 359f2e5b2e583..c6d912debf4cf 100644
--- a/nixos/doc/manual/release-notes/rl-2105.section.md
+++ b/nixos/doc/manual/release-notes/rl-2105.section.md
@@ -236,7 +236,7 @@ When upgrading from a previous release, please be aware of the following incompa
- The default version of ImageMagick has been updated from 6 to 7. You can use imagemagick6, imagemagick6_light, and imagemagick6Big if you need the older version.
-- [services.xserver.videoDrivers](options.html#opt-services.xserver.videoDrivers) no longer uses the deprecated `cirrus` and `vesa` device dependent X drivers by default. It also enables both `amdgpu` and `nouveau` drivers by default now.
+- [hardware.gpu.drivers](options.html#opt-hardware.gpu.drivers) no longer uses the deprecated `cirrus` and `vesa` device dependent X drivers by default. It also enables both `amdgpu` and `nouveau` drivers by default now.
- The `kindlegen` package is gone, because it is no longer supported or hosted by Amazon. Sadly, its replacement, Kindle Previewer, has no Linux support. However, there are other ways to generate MOBI files. See [the discussion](https://github.com/NixOS/nixpkgs/issues/96439) for more info.
diff --git a/nixos/modules/hardware/drivers.nix b/nixos/modules/hardware/drivers.nix
new file mode 100644
index 0000000000000..591125df614b8
--- /dev/null
+++ b/nixos/modules/hardware/drivers.nix
@@ -0,0 +1,135 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+
+ cfg = config.hardware.drivers;
+
+ kernelPackages = config.boot.kernelPackages;
+
+ videoDrivers = config.hardware.gpu.drivers;
+
+ drivers = pkgs.buildEnv {
+ name = "hardware-drivers";
+ paths = cfg.packages;
+ };
+
+ drivers32 = pkgs.buildEnv {
+ name = "hardware-drivers-32bit";
+ paths = cfg.packages32;
+ };
+
+in
+
+{
+
+ imports = [
+ (mkRenamedOptionModule [ "hardware" "opengl" "enable" ] [ "hardware" "drivers" "enable" ])
+ (mkRenamedOptionModule [ "hardware" "opengl" "package" ] [ "hardware" "drivers" "packages" ])
+ (mkRenamedOptionModule [ "hardware" "opengl" "extraPackage" ] [ "hardware" "drivers" "packages" ])
+ (mkRenamedOptionModule [ "hardware" "opengl" "driSupport32Bit" ] [ "hardware" "drivers" "enable32bit" ])
+ (mkRenamedOptionModule [ "services" "xserver" "vaapiDrivers" ] [ "hardware" "drivers" "packages" ])
+ (mkRemovedOptionModule [ "hardware" "opengl" "s3tcSupport" ] ''
+ S3TC support is now always enabled in Mesa.
+ '')
+ (mkRemovedOptionModule [ "hardware" "opengl" "driSupport" ] ''
+ dri support is now always enabled in Mesa.
+ '')
+ ];
+
+ options = {
+
+ hardware.drivers = {
+ enable = mkOption {
+ description = lib.mdDoc ''
+ Whether to enable hardware drivers. This will include GPU and other
+ hardware acceleration libraries. This is a requirement in X11 systems,
+ as well as for Wayland compositors like sway and Weston. It is enabled by default
+ by the corresponding modules, so you do not usually have to
+ set it yourself, only if there is no module for your wayland
+ compositor of choice. See services.xserver.enable and
+ programs.sway.enable.
+ '';
+ type = types.bool;
+ default = false;
+ };
+
+ enable32bit = mkOption {
+ type = types.bool;
+ default = false;
+ description = lib.mdDoc ''
+ On 64-bit systems, whether to include 32bit versions of drivers.
+ Most useful for `wine` and downstream packages.
+ '';
+ };
+
+ packages = mkOption {
+ type = types.listOf types.package;
+ example = literalExpression "with pkgs; [ vaapiIntel libvdpau-va-gl vaapiVdpau intel-ocl ]";
+ description = lib.mdDoc ''
+ Hardware acceleration drivers.
+ '';
+ };
+
+ packages32 = mkOption {
+ type = types.listOf types.package;
+ example = literalExpression "with pkgs.pkgsi686Linux; [ vaapiIntel libvdpau-va-gl vaapiVdpau ]";
+ description = lib.mdDoc ''
+ 32 bit hardware acceleration drivers.
+ '';
+ };
+
+ setLdLibraryPath = mkOption {
+ type = types.bool;
+ internal = true;
+ default = false;
+ description = lib.mdDoc ''
+ Whether the `LD_LIBRARY_PATH` environment variable
+ should be set to the locations of driver libraries. Drivers which
+ rely on overriding libraries should set this to true. Drivers which
+ support `libglvnd` and other dispatch libraries
+ instead of overriding libraries should not set this.
+ '';
+ };
+ };
+
+ };
+
+ config = mkIf cfg.enable {
+
+ assertions = [
+ { assertion = cfg.enable32bit -> pkgs.stdenv.isx86_64;
+ message = "Option enable32bit only makes sense on a 64-bit system.";
+ }
+ { assertion = cfg.enable32bit -> (config.boot.kernelPackages.kernel.features.ia32Emulation or false);
+ message = "Option enable32bit requires a kernel that supports 32bit emulation";
+ }
+ ];
+
+ # retain opengl-driver symlinks for backwards compatibility
+ systemd.tmpfiles.rules = [
+ "L+ /run/current-system/drivers - - - - ${drivers}"
+ "L+ /run/opengl-driver - - - - hardware-drivers"
+ ] ++ (if pkgs.stdenv.isi686 then [
+ "L+ /run/current-system/drivers-32 - - - - hardware-drivers"
+ "L+ /run/opengl-driver-32 - - - - hardware-drivers"
+ ] else if cfg.enable32bit then [
+ "L+ /run/current-system/drivers-32 - - - - ${drivers32}"
+ "L+ /run/opengl-driver-32 - - - - ${drivers32}"
+ ] else [
+ "r /run/opengl-driver-32"
+ "r /run/current-system/drivers-32"
+ ]);
+
+ environment.sessionVariables.LD_LIBRARY_PATH = mkIf cfg.setLdLibraryPath (
+ [ "/run/current-system/drivers/lib" ]
+ ++ optional cfg.enable32bit "/run/current-system/drivers-32/lib"
+ );
+
+ hardware.drivers.packages = mkDefault [ pkgs.mesa.drivers ];
+ hardware.drivers.packages32 = mkDefault [ pkgs.pkgsi686Linux.mesa.drivers ];
+
+ boot.extraModulePackages = optional (elem "virtualbox" videoDrivers) kernelPackages.virtualboxGuestAdditions;
+ };
+}
diff --git a/nixos/modules/hardware/gpu.nix b/nixos/modules/hardware/gpu.nix
new file mode 100644
index 0000000000000..75c9699074369
--- /dev/null
+++ b/nixos/modules/hardware/gpu.nix
@@ -0,0 +1,51 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+
+ # Abbreviations.
+ cfg = config.hardware.gpu;
+
+in {
+
+ options.hardware.gpu = {
+ enable = mkEnableOption (lib.mdDoc "Enable hardware drivers");
+
+ drivers = mkOption {
+ type = types.listOf types.str;
+ default = [ "amdgpu" "radeon" "nouveau" "modesetting" "fbdev" ];
+ example = [
+ "nvidia" "nvidiaLegacy390" "nvidiaLegacy340" "nvidiaLegacy304"
+ "amdgpu-pro"
+ ];
+ # TODO(@oxij): think how to easily add the rest, like those nvidia things
+ # TODO: fix this
+ # relatedPackages = concatLists
+ # (mapAttrsToList (n: v:
+ # optional (hasPrefix "xf86video" n) {
+ # path = [ "xorg" n ];
+ # title = removePrefix "xf86video" n;
+ # }) pkgs.xorg);
+ description = lib.mdDoc ''
+ The names of the video drivers the configuration
+ supports. They will be tried in order until one that
+ supports your card is found.
+ Don't combine those with "incompatible" OpenGL implementations,
+ e.g. free ones (mesa-based) with proprietary ones.
+
+ For unfree "nvidia*", the supported GPU lists are on
+ https://www.nvidia.com/object/unix.html
+ '';
+ };
+
+ };
+
+ config = mkIf cfg.enable {
+
+ hardware.drivers.enable = true;
+
+ };
+
+}
+
diff --git a/nixos/modules/hardware/opengl.nix b/nixos/modules/hardware/opengl.nix
deleted file mode 100644
index 5a5d88d9a4e00..0000000000000
--- a/nixos/modules/hardware/opengl.nix
+++ /dev/null
@@ -1,157 +0,0 @@
-{ config, lib, pkgs, ... }:
-
-with lib;
-
-let
-
- cfg = config.hardware.opengl;
-
- kernelPackages = config.boot.kernelPackages;
-
- videoDrivers = config.services.xserver.videoDrivers;
-
- package = pkgs.buildEnv {
- name = "opengl-drivers";
- paths = [ cfg.package ] ++ cfg.extraPackages;
- };
-
- package32 = pkgs.buildEnv {
- name = "opengl-drivers-32bit";
- paths = [ cfg.package32 ] ++ cfg.extraPackages32;
- };
-
-in
-
-{
-
- imports = [
- (mkRenamedOptionModule [ "services" "xserver" "vaapiDrivers" ] [ "hardware" "opengl" "extraPackages" ])
- (mkRemovedOptionModule [ "hardware" "opengl" "s3tcSupport" ] ''
- S3TC support is now always enabled in Mesa.
- '')
- ];
-
- options = {
-
- hardware.opengl = {
- enable = mkOption {
- description = lib.mdDoc ''
- Whether to enable OpenGL drivers. This is needed to enable
- OpenGL support in X11 systems, as well as for Wayland compositors
- like sway and Weston. It is enabled by default
- by the corresponding modules, so you do not usually have to
- set it yourself, only if there is no module for your wayland
- compositor of choice. See services.xserver.enable and
- programs.sway.enable.
- '';
- type = types.bool;
- default = false;
- };
-
- driSupport = mkOption {
- type = types.bool;
- default = true;
- description = lib.mdDoc ''
- Whether to enable accelerated OpenGL rendering through the
- Direct Rendering Interface (DRI).
- '';
- };
-
- driSupport32Bit = mkOption {
- type = types.bool;
- default = false;
- description = lib.mdDoc ''
- On 64-bit systems, whether to support Direct Rendering for
- 32-bit applications (such as Wine). This is currently only
- supported for the `nvidia` as well as
- `Mesa`.
- '';
- };
-
- package = mkOption {
- type = types.package;
- internal = true;
- description = lib.mdDoc ''
- The package that provides the OpenGL implementation.
- '';
- };
-
- package32 = mkOption {
- type = types.package;
- internal = true;
- description = lib.mdDoc ''
- The package that provides the 32-bit OpenGL implementation on
- 64-bit systems. Used when {option}`driSupport32Bit` is
- set.
- '';
- };
-
- extraPackages = mkOption {
- type = types.listOf types.package;
- default = [];
- example = literalExpression "with pkgs; [ vaapiIntel libvdpau-va-gl vaapiVdpau intel-ocl ]";
- description = lib.mdDoc ''
- Additional packages to add to OpenGL drivers. This can be used
- to add OpenCL drivers, VA-API/VDPAU drivers etc.
- '';
- };
-
- extraPackages32 = mkOption {
- type = types.listOf types.package;
- default = [];
- example = literalExpression "with pkgs.pkgsi686Linux; [ vaapiIntel libvdpau-va-gl vaapiVdpau ]";
- description = lib.mdDoc ''
- Additional packages to add to 32-bit OpenGL drivers on
- 64-bit systems. Used when {option}`driSupport32Bit` is
- set. This can be used to add OpenCL drivers, VA-API/VDPAU drivers etc.
- '';
- };
-
- setLdLibraryPath = mkOption {
- type = types.bool;
- internal = true;
- default = false;
- description = lib.mdDoc ''
- Whether the `LD_LIBRARY_PATH` environment variable
- should be set to the locations of driver libraries. Drivers which
- rely on overriding libraries should set this to true. Drivers which
- support `libglvnd` and other dispatch libraries
- instead of overriding libraries should not set this.
- '';
- };
- };
-
- };
-
- config = mkIf cfg.enable {
-
- assertions = [
- { assertion = cfg.driSupport32Bit -> pkgs.stdenv.isx86_64;
- message = "Option driSupport32Bit only makes sense on a 64-bit system.";
- }
- { assertion = cfg.driSupport32Bit -> (config.boot.kernelPackages.kernel.features.ia32Emulation or false);
- message = "Option driSupport32Bit requires a kernel that supports 32bit emulation";
- }
- ];
-
- systemd.tmpfiles.rules = [
- "L+ /run/opengl-driver - - - - ${package}"
- (
- if pkgs.stdenv.isi686 then
- "L+ /run/opengl-driver-32 - - - - opengl-driver"
- else if cfg.driSupport32Bit then
- "L+ /run/opengl-driver-32 - - - - ${package32}"
- else
- "r /run/opengl-driver-32"
- )
- ];
-
- environment.sessionVariables.LD_LIBRARY_PATH = mkIf cfg.setLdLibraryPath
- ([ "/run/opengl-driver/lib" ] ++ optional cfg.driSupport32Bit "/run/opengl-driver-32/lib");
-
- hardware.opengl.package = mkDefault pkgs.mesa.drivers;
- hardware.opengl.package32 = mkDefault pkgs.pkgsi686Linux.mesa.drivers;
-
- boot.extraModulePackages = optional (elem "virtualbox" videoDrivers) kernelPackages.virtualboxGuestAdditions;
- };
-}
diff --git a/nixos/modules/hardware/video/amdgpu-pro.nix b/nixos/modules/hardware/video/amdgpu-pro.nix
index 299a30b0629b1..d9f002d75505f 100644
--- a/nixos/modules/hardware/video/amdgpu-pro.nix
+++ b/nixos/modules/hardware/video/amdgpu-pro.nix
@@ -6,14 +6,14 @@ with lib;
let
- drivers = config.services.xserver.videoDrivers;
+ drivers = config.hardware.gpu.drivers;
enabled = elem "amdgpu-pro" drivers;
package = config.boot.kernelPackages.amdgpu-pro;
package32 = pkgs.pkgsi686Linux.linuxPackages.amdgpu-pro.override { kernel = null; };
- opengl = config.hardware.opengl;
+ opengl = config.hardware.drivers;
in
@@ -26,9 +26,9 @@ in
services.xserver.drivers = singleton
{ name = "amdgpu"; modules = [ package ]; display = true; };
- hardware.opengl.package = package;
- hardware.opengl.package32 = package32;
- hardware.opengl.setLdLibraryPath = true;
+ hardware.drivers.packages = [ package ];
+ hardware.drivers.packages32 = [ package32 ];
+ hardware.drivers.setLdLibraryPath = true;
boot.extraModulePackages = [ package.kmod ];
@@ -59,7 +59,7 @@ in
environment.systemPackages =
[ package.vulkan ] ++
# this isn't really DRI, but we'll reuse this option for now
- optional config.hardware.opengl.driSupport32Bit package32.vulkan;
+ optional config.hardware.drivers.driSupport32Bit package32.vulkan;
environment.etc = {
"modprobe.d/blacklist-radeon.conf".source = package + "/etc/modprobe.d/blacklist-radeon.conf";
diff --git a/nixos/modules/hardware/video/displaylink.nix b/nixos/modules/hardware/video/displaylink.nix
index 912f53da836a8..9ea8408db309a 100644
--- a/nixos/modules/hardware/video/displaylink.nix
+++ b/nixos/modules/hardware/video/displaylink.nix
@@ -4,7 +4,7 @@ with lib;
let
- enabled = elem "displaylink" config.services.xserver.videoDrivers;
+ enabled = elem "displaylink" config.hardware.gpu.drivers;
evdi = config.boot.kernelPackages.evdi;
diff --git a/nixos/modules/hardware/video/nvidia.nix b/nixos/modules/hardware/video/nvidia.nix
index 25cab06119751..169e86f19edeb 100644
--- a/nixos/modules/hardware/video/nvidia.nix
+++ b/nixos/modules/hardware/video/nvidia.nix
@@ -6,7 +6,7 @@ with lib;
let
nvidia_x11 = let
- drivers = config.services.xserver.videoDrivers;
+ drivers = config.hardware.gpu.drivers;
isDeprecated = str: (hasPrefix "nvidia" str) && (str != "nvidia");
hasDeprecated = drivers: any isDeprecated drivers;
in if (hasDeprecated drivers) then
@@ -108,7 +108,7 @@ in
without a multiplexer.
Note that this option only has any effect if the "nvidia" driver is specified
- in {option}`services.xserver.videoDrivers`, and it should preferably
+ in {option}`hardware.gpu.drivers`, and it should preferably
be the only driver there.
If this is enabled, then the bus IDs of the NVIDIA and Intel GPUs have to be
@@ -314,12 +314,12 @@ in
environment.etc."egl/egl_external_platform.d".source =
"/run/opengl-driver/share/egl/egl_external_platform.d/";
- hardware.opengl.extraPackages = [
- nvidia_x11.out
+ hardware.drivers.packages = [
+ cfg.package
pkgs.nvidia-vaapi-driver
];
- hardware.opengl.extraPackages32 = [
- nvidia_x11.lib32
+ hardware.drivers.packages32 = [
+ cfg.package.lib32
pkgs.pkgsi686Linux.nvidia-vaapi-driver
];
diff --git a/nixos/modules/installer/tools/nixos-generate-config.pl b/nixos/modules/installer/tools/nixos-generate-config.pl
index 212b2b3cd23a2..664cc26032642 100644
--- a/nixos/modules/installer/tools/nixos-generate-config.pl
+++ b/nixos/modules/installer/tools/nixos-generate-config.pl
@@ -347,7 +347,7 @@ sub findStableDevPath {
return $dev;
}
-push @attrs, "services.xserver.videoDrivers = [ \"$videoDriver\" ];" if $videoDriver;
+push @attrs, "hardware.gpu.drivers = [ \"$videoDriver\" ];" if $videoDriver;
# Generate the swapDevices option from the currently activated swap
# devices.
diff --git a/nixos/modules/installer/virtualbox-demo.nix b/nixos/modules/installer/virtualbox-demo.nix
index 27a7651382b25..8549fa532581f 100644
--- a/nixos/modules/installer/virtualbox-demo.nix
+++ b/nixos/modules/installer/virtualbox-demo.nix
@@ -18,7 +18,7 @@ with lib;
# Add some more video drivers to give X11 a shot at working in
# VMware and QEMU.
- services.xserver.videoDrivers = mkOverride 40 [ "virtualbox" "vmware" "cirrus" "vesa" "modesetting" ];
+ hardware.gpu.drivers = mkOverride 40 [ "virtualbox" "vmware" "cirrus" "vesa" "modesetting" ];
powerManagement.enable = false;
system.stateVersion = mkDefault "18.03";
diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix
index c400fadef3a2a..f5bd5c2cfcdf4 100644
--- a/nixos/modules/module-list.nix
+++ b/nixos/modules/module-list.nix
@@ -51,7 +51,9 @@
./hardware/corectrl.nix
./hardware/digitalbitbox.nix
./hardware/device-tree.nix
+ ./hardware/drivers.nix
./hardware/gkraken.nix
+ ./hardware/gpu.nix
./hardware/flirc.nix
./hardware/gpgsmartcards.nix
./hardware/i2c.nix
@@ -70,7 +72,6 @@
./hardware/network/intel-2200bg.nix
./hardware/new-lg4ff.nix
./hardware/nitrokey.nix
- ./hardware/opengl.nix
./hardware/openrazer.nix
./hardware/pcmcia.nix
./hardware/printers.nix
diff --git a/nixos/modules/programs/steam.nix b/nixos/modules/programs/steam.nix
index adbbf5d9ed4b4..e31d450341fe1 100644
--- a/nixos/modules/programs/steam.nix
+++ b/nixos/modules/programs/steam.nix
@@ -6,10 +6,10 @@ let
cfg = config.programs.steam;
steam = pkgs.steam.override {
- extraLibraries = pkgs: with config.hardware.opengl;
+ extraLibraries = pkgs: with config.hardware.drivers;
if pkgs.hostPlatform.is64bit
- then [ package ] ++ extraPackages
- else [ package32 ] ++ extraPackages32;
+ then packages
+ else packages32;
};
in {
options.programs.steam = {
@@ -33,11 +33,7 @@ in {
};
config = mkIf cfg.enable {
- hardware.opengl = { # this fixes the "glXChooseVisual failed" bug, context: https://github.com/NixOS/nixpkgs/issues/47932
- enable = true;
- driSupport = true;
- driSupport32Bit = true;
- };
+ hardware.drivers.enable = true;
# optionally enable 32bit pulseaudio support if pulseaudio is enabled
hardware.pulseaudio.support32Bit = config.hardware.pulseaudio.enable;
diff --git a/nixos/modules/programs/sway.nix b/nixos/modules/programs/sway.nix
index b0a766dd055f5..5df348bf7df45 100644
--- a/nixos/modules/programs/sway.nix
+++ b/nixos/modules/programs/sway.nix
@@ -135,7 +135,7 @@ in {
};
security.polkit.enable = true;
security.pam.services.swaylock = {};
- hardware.opengl.enable = mkDefault true;
+ hardware.drivers.enable = mkDefault true;
fonts.enableDefaultFonts = mkDefault true;
programs.dconf.enable = mkDefault true;
# To make a Sway session available if a display manager like SDDM is enabled:
diff --git a/nixos/modules/programs/turbovnc.nix b/nixos/modules/programs/turbovnc.nix
index a0e4a36cfd995..246ba4701c6d7 100644
--- a/nixos/modules/programs/turbovnc.nix
+++ b/nixos/modules/programs/turbovnc.nix
@@ -19,7 +19,7 @@ in
Whether to set up NixOS such that TurboVNC's built-in software OpenGL
implementation works.
- This will enable {option}`hardware.opengl.enable` so that OpenGL
+ This will enable {option}`hardware.drivers.enable` so that OpenGL
programs can find Mesa's llvmpipe drivers.
Setting this option to `false` does not mean that software
@@ -48,7 +48,7 @@ in
# can find the llvmpipe `swrast.so` software rendering DRI lib via `libglvnd`.
# This comment exists to explain why `hardware.` is involved,
# even though 100% software rendering is used.
- hardware.opengl.enable = true;
+ hardware.drivers.enable = true;
};
}
diff --git a/nixos/modules/services/ttys/kmscon.nix b/nixos/modules/services/ttys/kmscon.nix
index f5a8d8b104d2f..3a7b8441c69f4 100644
--- a/nixos/modules/services/ttys/kmscon.nix
+++ b/nixos/modules/services/ttys/kmscon.nix
@@ -106,7 +106,7 @@ in {
fonts = optional (cfg.fonts != null) "font-name=${lib.concatMapStringsSep ", " (f: f.name) cfg.fonts}";
in lib.concatStringsSep "\n" (render ++ fonts);
- hardware.opengl.enable = mkIf cfg.hwRender true;
+ hardware.drivers.enable = mkIf cfg.hwRender true;
fonts = mkIf (cfg.fonts != null) {
fontconfig.enable = true;
diff --git a/nixos/modules/services/wayland/cage.nix b/nixos/modules/services/wayland/cage.nix
index 330dce1d0c0ff..d8cdb826b99b5 100644
--- a/nixos/modules/services/wayland/cage.nix
+++ b/nixos/modules/services/wayland/cage.nix
@@ -91,7 +91,7 @@ in {
session required ${config.systemd.package}/lib/security/pam_systemd.so
'';
- hardware.opengl.enable = mkDefault true;
+ hardware.drivers.enable = mkDefault true;
systemd.targets.graphical.wants = [ "cage-tty1.service" ];
diff --git a/nixos/modules/services/x11/desktop-managers/phosh.nix b/nixos/modules/services/x11/desktop-managers/phosh.nix
index e889c0e34e7d8..3efefaff2ca96 100644
--- a/nixos/modules/services/x11/desktop-managers/phosh.nix
+++ b/nixos/modules/services/x11/desktop-managers/phosh.nix
@@ -209,7 +209,7 @@ in
security.pam.services.phosh = {};
- hardware.opengl.enable = mkDefault true;
+ hardware.drivers.enable = mkDefault true;
services.gnome.core-shell.enable = true;
services.gnome.core-os-services.enable = true;
diff --git a/nixos/modules/services/x11/display-managers/xpra.nix b/nixos/modules/services/x11/display-managers/xpra.nix
index cb78f52d9b689..44e910683c3c7 100644
--- a/nixos/modules/services/x11/display-managers/xpra.nix
+++ b/nixos/modules/services/x11/display-managers/xpra.nix
@@ -53,7 +53,7 @@ in
###### implementation
config = mkIf cfg.enable {
- services.xserver.videoDrivers = ["dummy"];
+ hardware.gpu.drivers = ["dummy"];
services.xserver.monitorSection = ''
HorizSync 1.0 - 2000.0
diff --git a/nixos/modules/services/x11/terminal-server.nix b/nixos/modules/services/x11/terminal-server.nix
index e6b50c21a9526..501ddfda05bd0 100644
--- a/nixos/modules/services/x11/terminal-server.nix
+++ b/nixos/modules/services/x11/terminal-server.nix
@@ -14,7 +14,7 @@ with lib;
config = {
services.xserver.enable = true;
- services.xserver.videoDrivers = [];
+ hardware.gpu.drivers = [];
# Enable GDM. Any display manager will do as long as it supports XDMCP.
services.xserver.displayManager.gdm.enable = true;
diff --git a/nixos/modules/services/x11/xserver.nix b/nixos/modules/services/x11/xserver.nix
index 83a71dcf23e00..45674a86fba6c 100644
--- a/nixos/modules/services/x11/xserver.nix
+++ b/nixos/modules/services/x11/xserver.nix
@@ -6,10 +6,10 @@ let
# Abbreviations.
cfg = config.services.xserver;
+ gpuCfg = config.hardware.gpu;
xorg = pkgs.xorg;
- # Map video driver names to driver packages. FIXME: move into card-specific modules.
knownVideoDrivers = {
# Alias so people can keep using "virtualbox" instead of "vboxvideo".
virtualbox = { modules = [ xorg.xf86videovboxvideo ]; driverName = "vboxvideo"; };
@@ -155,6 +155,9 @@ in
"Use services.xserver.fontPath instead of useXFS")
(mkRemovedOptionModule [ "services" "xserver" "useGlamor" ]
"Option services.xserver.useGlamor was removed because it is unnecessary. Drivers that uses Glamor will use it automatically.")
+ (mkRemovedOptionModule ["services" "xserver" "videoDriver" ]
+ "Use hardware.gpu.drivers instead")
+ (mkRenamedOptionModule [ "services" "xserver" "videoDrivers" ] [ "hardware" "gpu" "drivers" ])
];
@@ -254,43 +257,6 @@ in
'';
};
- videoDrivers = mkOption {
- type = types.listOf types.str;
- default = [ "amdgpu" "radeon" "nouveau" "modesetting" "fbdev" ];
- example = [
- "nvidia" "nvidiaLegacy390" "nvidiaLegacy340" "nvidiaLegacy304"
- "amdgpu-pro"
- ];
- # TODO(@oxij): think how to easily add the rest, like those nvidia things
- relatedPackages = concatLists
- (mapAttrsToList (n: v:
- optional (hasPrefix "xf86video" n) {
- path = [ "xorg" n ];
- title = removePrefix "xf86video" n;
- }) pkgs.xorg);
- description = lib.mdDoc ''
- The names of the video drivers the configuration
- supports. They will be tried in order until one that
- supports your card is found.
- Don't combine those with "incompatible" OpenGL implementations,
- e.g. free ones (mesa-based) with proprietary ones.
-
- For unfree "nvidia*", the supported GPU lists are on
- https://www.nvidia.com/object/unix.html
- '';
- };
-
- videoDriver = mkOption {
- type = types.nullOr types.str;
- default = null;
- example = "i810";
- description = lib.mdDoc ''
- The name of the video driver for your graphics card. This
- option is obsolete; please set the
- {option}`services.xserver.videoDrivers` instead.
- '';
- };
-
drivers = mkOption {
type = types.listOf types.attrs;
internal = true;
@@ -604,12 +570,10 @@ in
|| dmConf.lightdm.enable);
in mkIf (noDmUsed) (mkDefault false);
- hardware.opengl.enable = mkDefault true;
-
- services.xserver.videoDrivers = mkIf (cfg.videoDriver != null) [ cfg.videoDriver ];
+ hardware.drivers.enable = mkDefault true;
# FIXME: somehow check for unknown driver names.
- services.xserver.drivers = flip concatMap cfg.videoDrivers (name:
+ services.xserver.drivers = flip concatMap gpuCfg.drivers (name:
let driver =
attrByPath [name]
(if xorg ? ${"xf86video" + name}
@@ -698,7 +662,7 @@ in
restartIfChanged = false;
environment =
- optionalAttrs config.hardware.opengl.setLdLibraryPath
+ optionalAttrs config.hardware.drivers.setLdLibraryPath
{ LD_LIBRARY_PATH = lib.makeLibraryPath [ pkgs.addOpenGLRunpath.driverLink ]; }
// cfg.displayManager.job.environment;
diff --git a/nixos/modules/virtualisation/docker.nix b/nixos/modules/virtualisation/docker.nix
index d9bd10ba1fc8f..37e33439edfe1 100644
--- a/nixos/modules/virtualisation/docker.nix
+++ b/nixos/modules/virtualisation/docker.nix
@@ -226,7 +226,7 @@ in
};
assertions = [
- { assertion = cfg.enableNvidia -> config.hardware.opengl.driSupport32Bit or false;
+ { assertion = cfg.enableNvidia -> config.hardware.drivers.driSupport32Bit or false;
message = "Option enableNvidia requires 32bit support libraries";
}];
diff --git a/nixos/modules/virtualisation/qemu-vm.nix b/nixos/modules/virtualisation/qemu-vm.nix
index edc6dfdc15ae9..b74df9a2ac1d9 100644
--- a/nixos/modules/virtualisation/qemu-vm.nix
+++ b/nixos/modules/virtualisation/qemu-vm.nix
@@ -1103,7 +1103,7 @@ in
# When building a regular system configuration, override whatever
# video driver the host uses.
- services.xserver.videoDrivers = mkVMOverride [ "modesetting" ];
+ hardware.gpu.drivers = mkVMOverride [ "modesetting" ];
services.xserver.defaultDepth = mkVMOverride 0;
services.xserver.resolutions = mkVMOverride [ cfg.resolution ];
services.xserver.monitorSection =
diff --git a/nixos/modules/virtualisation/virtualbox-guest.nix b/nixos/modules/virtualisation/virtualbox-guest.nix
index 94f70c65436c1..d14e848d889c8 100644
--- a/nixos/modules/virtualisation/virtualbox-guest.nix
+++ b/nixos/modules/virtualisation/virtualbox-guest.nix
@@ -68,7 +68,7 @@ in
SUBSYSTEM=="misc", KERNEL=="vboxguest", TAG+="systemd"
'';
} (mkIf cfg.x11 {
- services.xserver.videoDrivers = [ "vmware" "virtualbox" "modesetting" ];
+ hardware.gpu.drivers = [ "vmware" "virtualbox" "modesetting" ];
services.xserver.config =
''
diff --git a/nixos/tests/cagebreak.nix b/nixos/tests/cagebreak.nix
index 1fef7cb57cfc5..d5746ec616acf 100644
--- a/nixos/tests/cagebreak.nix
+++ b/nixos/tests/cagebreak.nix
@@ -31,7 +31,7 @@ in
fi
'';
- hardware.opengl.enable = true;
+ hardware.drivers.enable = true;
programs.xwayland.enable = true;
security.polkit.enable = true;
environment.systemPackages = [ pkgs.cagebreak pkgs.wayland-utils ];
diff --git a/nixos/tests/openarena.nix b/nixos/tests/openarena.nix
index 63dc1b9a68570..017a9a7465c2b 100644
--- a/nixos/tests/openarena.nix
+++ b/nixos/tests/openarena.nix
@@ -5,7 +5,7 @@ let
{ pkgs, ... }:
{ imports = [ ./common/x11.nix ];
- hardware.opengl.driSupport = true;
+ hardware.drivers.enable = true;
environment.systemPackages = [ pkgs.openarena ];
};