From c5b97600fe2366c4c78d3d8906406558e1e5aadc Mon Sep 17 00:00:00 2001 From: Daniel Langbein Date: Sun, 4 Feb 2024 14:50:41 +0100 Subject: [PATCH] update docs --- NixOS.md | 35 ++++------------------------------- README.md | 2 +- modules/gpu-amd.nix | 36 ++++++++++++++++++++++++++++++++++++ 3 files changed, 41 insertions(+), 32 deletions(-) create mode 100644 modules/gpu-amd.nix diff --git a/NixOS.md b/NixOS.md index 01f9bce..1b51e85 100644 --- a/NixOS.md +++ b/NixOS.md @@ -206,7 +206,7 @@ nix-locate --whole-name '/bash' ## List files of package -* https://discourse.nixos.org/t/list-files-of-package/25830/2?u=langfingaz +* https://discourse.nixos.org/t/list-files-of-package/25830/2 Example for `nano`: @@ -695,34 +695,7 @@ Video acceleration: Verification in general: - Encode a video or play a game and watch AMD GPU usage with `radeontop`. -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 - ]; -}; -``` +Configuration example for an AMD GPU (https://github.com/tolgaerok/nixos-kde/blob/main/core/gpu/amd/default.nix): See [./modules/gpu-amd.nix](./modules/gpu-amd.nix) ## Additional resources @@ -732,8 +705,8 @@ hardware.opengl = { * Documenting the Journey of Learning and Mastering Nix. https://ianthehenry.com/posts/how-to-learn-nix/ * Nix language basics. https://nix.dev/tutorials/nix-language.html * Nix data types. https://nixos.org/manual/nix/stable/language/values -* MkIfElse. https://discourse.nixos.org/t/mkif-vs-if-then/28521/4?u=langfingaz -* Nix language basics - a one pager. https://github.com/tazjin/nix-1p#nix---a-one-pager +* MkIfElse. https://discourse.nixos.org/t/mkif-vs-if-then/28521/4 +* Nix language basics - a one-pager. https://github.com/tazjin/nix-1p#nix---a-one-pager ### Nix Pills diff --git a/README.md b/README.md index a04af0d..dbd1bca 100644 --- a/README.md +++ b/README.md @@ -89,7 +89,7 @@ A slightly modified config can be found in [./hosts/pi3bplus](./hosts/pi3bplus) #### Apply modified configuration -The Rapberry Pi 3B+ has only 1GB RAM, which is not enough for `nixos-rebuild`. It is recommended to create and activate a SWAP file first: https://wiki.archlinux.org/title/swap#Swap_file_creation +The Raspberry Pi 3B+ has only 1GB RAM, which is not enough for `nixos-rebuild`. It is recommended to create and activate a SWAP file first: https://wiki.archlinux.org/title/swap#Swap_file_creation ```shell nix-channel --list diff --git a/modules/gpu-amd.nix b/modules/gpu-amd.nix new file mode 100644 index 0000000..813925f --- /dev/null +++ b/modules/gpu-amd.nix @@ -0,0 +1,36 @@ +{ config, pkgs, ... }: +{ + # See `NixOS.md` at section "Graphic drivers" + + 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; + driSupport32Bit = 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 + + # Xorg driver for AMD Radeon GPUs using the amdgpu kernel driver + # https://gitlab.freedesktop.org/xorg/driver/xf86-video-amdgpu + pkgs.xorg.xf86videoamdgpu + ]; + }; +}