update docs

This commit is contained in:
Daniel Langbein 2024-02-04 14:50:41 +01:00
parent f87288bba6
commit c5b97600fe
Signed by: langfingaz
GPG Key ID: 6C47C753F0823002
3 changed files with 41 additions and 32 deletions

View File

@ -206,7 +206,7 @@ nix-locate --whole-name '/bash'
## List files of package ## 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`: Example for `nano`:
@ -695,34 +695,7 @@ Video acceleration:
Verification in general: Verification in general:
- Encode a video or play a game and watch AMD GPU usage with `radeontop`. - Encode a video or play a game and watch AMD GPU usage with `radeontop`.
Configuration example for an AMD GPU: 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)
```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 ## Additional resources
@ -732,8 +705,8 @@ hardware.opengl = {
* Documenting the Journey of Learning and Mastering Nix. https://ianthehenry.com/posts/how-to-learn-nix/ * 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 language basics. https://nix.dev/tutorials/nix-language.html
* Nix data types. https://nixos.org/manual/nix/stable/language/values * 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 * 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 language basics - a one-pager. https://github.com/tazjin/nix-1p#nix---a-one-pager
### Nix Pills ### Nix Pills

View File

@ -89,7 +89,7 @@ A slightly modified config can be found in [./hosts/pi3bplus](./hosts/pi3bplus)
#### Apply modified configuration #### 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 ```shell
nix-channel --list nix-channel --list

36
modules/gpu-amd.nix Normal file
View File

@ -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
];
};
}