diff --git a/NixOS.md b/NixOS.md index b02b632..5a1ade8 100644 --- a/NixOS.md +++ b/NixOS.md @@ -414,6 +414,56 @@ nix-shell -p appimage-run appimage-run ~/Downloads/ubports-installer_0.10.0_linux_x86_64.AppImage ``` +## Graphic drivers + +Usually most of this should work out of the box on NixOS. + +Vulkan: +- Verification: If `vulkaninfo` returns information about your GPU, Vulkan is working. https://wiki.archlinux.org/title/Vulkan#Verification + +OpenGL: +- Verification: https://wiki.archlinux.org/title/OpenGL#Verification + - `eglinfo -B` should not return `eglInitialize failed` + - `eglgears_x11` and `eglgears_wayland` -> ![eglgears.png](assets/doc/eglgears.png) + +Video acceleration: +- VA-API + - Verifying: `vainfo` -> E.g. `Driver version: Mesa Gallium driver 23.1.9 for AMD Radeon Graphics`. https://wiki.archlinux.org/title/Hardware_video_acceleration#Verifying_VA-API + - Driver comparison chart. https://wiki.archlinux.org/title/Hardware_video_acceleration#VA-API_drivers + - With `libva-mesa-driver` on "Radeon RX 7900 and higher/newer" a codec for encoding AV1 8 and 10 bit is available. +- VDPAU + - Video Decode and Presentation API for Unix (VDPAU). + - Verifying: `vdpauinfo`. https://wiki.archlinux.org/title/Hardware_video_acceleration#Verifying_VDPAU + +Configuration example for an AMD GPU: + +```nix +hardware.opengl = { + enable = true; + # Whether to enable accelerated OpenGL rendering through the Direct Rendering Interface (DRI). + # The Direct Rendering Infrastructure (DRI) is the framework comprising the modern Linux graphics [...]. The main use of DRI is to provide hardware acceleration for the Mesa implementation of OpenGL. + driSupport = true; + extraPackages = [ + # AMD Open Source Driver For Vulkan + pkgs.amdvlk + + # Encoding/decoding acceleration + # + # VDPAU driver with OpenGL/VAAPI backend + pkgs.libvdpau-va-gl + # VDPAU driver for the VAAPI library + pkgs.vaapiVdpau + + # OpenCL (Open Computing Language) is a framework for writing programs that execute across heterogeneous platforms. + # + # OpenCL ICD definition for AMD GPUs using the ROCm stack. + pkgs.rocm-opencl-icd + # OpenCL runtime for AMD GPUs, part of the ROCm stack. + pkgs.rocm-opencl-runtime + ]; +}; +``` + ## Additional resources * Simple NixOS flake template for NixOS with HomeManager. https://github.com/Misterio77/nix-starter-configs#readme diff --git a/assets/doc/eglgears.png b/assets/doc/eglgears.png new file mode 100644 index 0000000..9926821 Binary files /dev/null and b/assets/doc/eglgears.png differ