Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP nixos/opengl: move to hardware.drivers #158079

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 9 additions & 12 deletions nixos/doc/manual/configuration/gpu-accel.chapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand All @@ -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
];
```
Expand All @@ -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
];
```
Expand All @@ -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.
Expand All @@ -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.

Expand Down Expand Up @@ -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
];

Expand Down
20 changes: 10 additions & 10 deletions nixos/doc/manual/configuration/x-windows.chapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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}
Expand Down Expand Up @@ -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"
Expand All @@ -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
Expand All @@ -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
Expand Down
41 changes: 20 additions & 21 deletions nixos/doc/manual/from_md/configuration/gpu-accel.chapter.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,10 @@ $ export \
</programlisting>
<para>
The second mechanism is to add the OpenCL driver package to
<xref linkend="opt-hardware.opengl.extraPackages" />. This links
the ICD file under <literal>/run/opengl-driver</literal>, where it
will be visible to the ICD loader.
<link xlink:href="options.html#opt-hardware.drivers.packages"></link>.
This links the ICD file under
<literal>/run/opengl-driver</literal>, where it will be visible to
the ICD loader.
</para>
<para>
The proper installation of OpenCL drivers can be verified through
Expand All @@ -59,11 +60,11 @@ Platform Vendor Advanced Micro Devices, Inc.
<link xlink:href="https://en.wikipedia.org/wiki/Graphics_Core_Next">Graphics
Core Next</link> (GCN) GPUs are supported through the
rocm-opencl-icd package. Adding this package to
<xref linkend="opt-hardware.opengl.extraPackages" /> enables
OpenCL support:
<link xlink:href="options.html#opt-hardware.drivers.packages"></link>
enables OpenCL support:
</para>
<programlisting language="bash">
hardware.opengl.extraPackages = [
hardware.drivers.packages = [
rocm-opencl-icd
];
</programlisting>
Expand All @@ -81,12 +82,13 @@ hardware.opengl.extraPackages = [
</para>
<para>
The intel-compute-runtime, beignet, or intel-ocl package can be
added to <xref linkend="opt-hardware.opengl.extraPackages" /> to
enable OpenCL support. For example, for Gen8 and later GPUs, the
following configuration can be used:
added to
<link xlink:href="options.html#opt-hardware.drivers.packages"></link>
to enable OpenCL support. For example, for Gen8 and later GPUs,
the following configuration can be used:
</para>
<programlisting language="bash">
hardware.opengl.extraPackages = [
hardware.drivers.packages = [
intel-compute-runtime
];
</programlisting>
Expand All @@ -100,11 +102,6 @@ hardware.opengl.extraPackages = [
games or indirectly though compatibility layers like
<link xlink:href="https://github.com/doitsujin/dxvk/wiki">DXVK</link>.
</para>
<para>
By default, if <xref linkend="opt-hardware.opengl.driSupport" />
is enabled, mesa is installed and provides Vulkan for supported
hardware.
</para>
<para>
Similar to OpenCL, Vulkan drivers are loaded through the
<emphasis>Installable Client Driver</emphasis> (ICD) mechanism.
Expand All @@ -126,9 +123,10 @@ $ export \
</programlisting>
<para>
The second mechanism is to add the Vulkan driver package to
<xref linkend="opt-hardware.opengl.extraPackages" />. This links
the ICD file under <literal>/run/opengl-driver</literal>, where it
will be visible to the ICD loader.
<link xlink:href="options.html#opt-hardware.drivers.packages"></link>.
This links the ICD file under
<literal>/run/opengl-driver</literal>, where it will be visible to
the ICD loader.
</para>
<para>
The proper installation of Vulkan drivers can be verified through
Expand Down Expand Up @@ -158,17 +156,18 @@ GPU1:
<link xlink:href="https://en.wikipedia.org/wiki/Graphics_Core_Next">Graphics
Core Next</link> (GCN) GPUs are supported through either radv,
which is part of mesa, or the amdvlk package. Adding the amdvlk
package to <xref linkend="opt-hardware.opengl.extraPackages" />
package to
<link xlink:href="options.html#opt-hardware.drivers.packages"></link>
makes amdvlk the default driver and hides radv and lavapipe from
the device list. A specific driver can be forced as follows:
</para>
<programlisting language="bash">
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
];

Expand Down
22 changes: 11 additions & 11 deletions nixos/doc/manual/from_md/configuration/x-windows.chapter.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ services.xserver.enable = true;
manually, e.g.
</para>
<programlisting language="bash">
services.xserver.videoDrivers = [ &quot;r128&quot; ];
hardware.gpu.drivers = [ &quot;r128&quot; ];
</programlisting>
<para>
to enable X.org’s <literal>xf86-video-r128</literal> driver.
Expand Down Expand Up @@ -71,7 +71,7 @@ services.xserver.autorun = false;
Wine, you should also set the following:
</para>
<programlisting language="bash">
hardware.opengl.driSupport32Bit = true;
hardware.drivers.enable32bit = true;
</programlisting>
<section xml:id="sec-x11-auto-login">
<title>Auto-login</title>
Expand Down Expand Up @@ -128,18 +128,18 @@ services.xserver.displayManager.autoLogin.user = &quot;alice&quot;;
<para>
The results vary depending on the hardware, so you may have to try
both drivers. Use the option
<xref linkend="opt-services.xserver.videoDrivers" /> to set one.
The recommended configuration for modern systems is:
<xref linkend="opt-hardware.gpu.drivers" /> to set one. The
recommended configuration for modern systems is:
</para>
<programlisting language="bash">
services.xserver.videoDrivers = [ &quot;modesetting&quot; ];
hardware.gpu.drivers = [ &quot;modesetting&quot; ];
</programlisting>
<para>
If you experience screen tearing no matter what, this
configuration was reported to resolve the issue:
</para>
<programlisting language="bash">
services.xserver.videoDrivers = [ &quot;intel&quot; ];
hardware.gpu.drivers = [ &quot;intel&quot; ];
services.xserver.deviceSection = ''
Option &quot;DRI&quot; &quot;2&quot;
Option &quot;TearFree&quot; &quot;true&quot;
Expand All @@ -160,16 +160,16 @@ services.xserver.deviceSection = ''
it as follows:
</para>
<programlisting language="bash">
services.xserver.videoDrivers = [ &quot;nvidia&quot; ];
hardware.gpu.drivers = [ &quot;nvidia&quot; ];
</programlisting>
<para>
Or if you have an older card, you may have to use one of the
legacy drivers:
</para>
<programlisting language="bash">
services.xserver.videoDrivers = [ &quot;nvidiaLegacy390&quot; ];
services.xserver.videoDrivers = [ &quot;nvidiaLegacy340&quot; ];
services.xserver.videoDrivers = [ &quot;nvidiaLegacy304&quot; ];
hardware.gpu.drivers = [ &quot;nvidiaLegacy390&quot; ];
hardware.gpu.drivers = [ &quot;nvidiaLegacy340&quot; ];
hardware.gpu.drivers = [ &quot;nvidiaLegacy304&quot; ];
</programlisting>
<para>
You may need to reboot after enabling this driver to prevent a
Expand All @@ -186,7 +186,7 @@ services.xserver.videoDrivers = [ &quot;nvidiaLegacy304&quot; ];
need to explicitly set:
</para>
<programlisting language="bash">
services.xserver.videoDrivers = [ &quot;amdgpu-pro&quot; ];
hardware.gpu.drivers = [ &quot;amdgpu-pro&quot; ];
</programlisting>
<para>
You will need to reboot after enabling this driver to prevent a
Expand Down
5 changes: 2 additions & 3 deletions nixos/doc/manual/from_md/release-notes/rl-1603.section.xml
Original file line number Diff line number Diff line change
Expand Up @@ -506,9 +506,8 @@ nginx.override {
<listitem>
<para>
<literal>services.xserver.vaapiDrivers</literal> has been
removed. Use
<literal>hardware.opengl.extraPackages{,32}</literal> instead.
You can also specify VDPAU drivers there.
removed. Use <literal>hardware.drivers.packages{,32}</literal>
instead. You can also specify VDPAU drivers there.
</para>
</listitem>
<listitem>
Expand Down
2 changes: 1 addition & 1 deletion nixos/doc/manual/from_md/release-notes/rl-1903.section.xml
Original file line number Diff line number Diff line change
Expand Up @@ -746,7 +746,7 @@
<para>
The <literal>intel</literal> driver has been removed from the
default list of
<link xlink:href="options.html#opt-services.xserver.videoDrivers">X.org
<link xlink:href="options.html#opt-hardware.gpu.drivers">X.org
video drivers</link>. The <literal>modesetting</literal>
driver should take over automatically, it is better maintained
upstream and has less problems with advanced X11 features.
Expand Down
4 changes: 2 additions & 2 deletions nixos/doc/manual/from_md/release-notes/rl-2009.section.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2076,14 +2076,14 @@ CREATE ROLE postgres LOGIN SUPERUSER;
<para>
For AMD GPUs, Vulkan can now be used by adding
<literal>amdvlk</literal> to
<literal>hardware.opengl.extraPackages</literal>.
<literal>hardware.drivers.packages</literal>.
</para>
</listitem>
<listitem>
<para>
Similarly, still for AMD GPUs, the ROCm OpenCL stack can now
be used by adding <literal>rocm-opencl-icd</literal> to
<literal>hardware.opengl.extraPackages</literal>.
<literal>hardware.drivers.packages</literal>.
</para>
</listitem>
</itemizedlist>
Expand Down
2 changes: 1 addition & 1 deletion nixos/doc/manual/from_md/release-notes/rl-2105.section.xml
Original file line number Diff line number Diff line change
Expand Up @@ -810,7 +810,7 @@ self: super:
</listitem>
<listitem>
<para>
<link xlink:href="options.html#opt-services.xserver.videoDrivers">services.xserver.videoDrivers</link>
<link xlink:href="options.html#opt-hardware.gpu.drivers">hardware.gpu.drivers</link>
no longer uses the deprecated <literal>cirrus</literal> and
<literal>vesa</literal> device dependent X drivers by default.
It also enables both <literal>amdgpu</literal> and
Expand Down
2 changes: 1 addition & 1 deletion nixos/doc/manual/release-notes/rl-1603.section.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
2 changes: 1 addition & 1 deletion nixos/doc/manual/release-notes/rl-1903.section.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).

Expand Down
4 changes: 2 additions & 2 deletions nixos/doc/manual/release-notes/rl-2009.section.md
Original file line number Diff line number Diff line change
Expand Up @@ -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}

Expand Down
2 changes: 1 addition & 1 deletion nixos/doc/manual/release-notes/rl-2105.section.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
Loading