generated from ublue-os/udev-rules
-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(just): merge nvidia recipes into configure-nvidia
- Loading branch information
1 parent
bcf22fd
commit 44e7d4c
Showing
1 changed file
with
44 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,48 @@ | ||
# vim: set ft=make : | ||
|
||
# Set needed kernel arguments for Nvidia GPUs | ||
nvidia-set-kargs: | ||
# Configure the Nvidia driver | ||
configure-nvidia: | ||
#!/usr/bin/env bash | ||
if command -v nvidia-smi; then | ||
rpm-ostree kargs \ | ||
--append-if-missing=rd.driver.blacklist=nouveau \ | ||
--append-if-missing=modprobe.blacklist=nouveau \ | ||
--append-if-missing=nvidia-drm.modeset=1 \ | ||
--delete-if-present=nomodeset | ||
else | ||
echo 'You do not appear to be on a Nvidia image, please refer to the README for your uBlue-OS image.' | ||
fi | ||
|
||
# Test CUDA support for Nvidia GPUs | ||
nvidia-test-cuda: | ||
#!/usr/bin/env bash | ||
if lsmod | grep -wq "nvidia"; then | ||
podman run \ | ||
--user 1000:1000 \ | ||
--security-opt=no-new-privileges \ | ||
--cap-drop=ALL \ | ||
--security-opt label=type:nvidia_container_t \ | ||
--device=nvidia.com/gpu=all \ | ||
docker.io/nvidia/samples:vectoradd-cuda11.2.1 | ||
else | ||
echo 'The Nvidia kernel module is not loaded. You may be using secure boot without the needed signing key, lacking the needed kargs, or may not be on a Nvidia image. See "just enroll-secure-boot-key" and "just nvidia-set-kargs".' | ||
fi | ||
|
||
# Enable VAAPI in Firefox Flatpak for Nvidia GPUs | ||
nvidia-setup-firefox-vaapi: | ||
#!/usr/bin/env bash | ||
if lsmod | grep -wq "nvidia"; then | ||
flatpak override \ | ||
--user \ | ||
--filesystem=host-os \ | ||
--env=LIBVA_DRIVER_NAME=nvidia \ | ||
--env=LIBVA_DRIVERS_PATH=/run/host/usr/lib64/dri \ | ||
--env=LIBVA_MESSAGING_LEVEL=1 \ | ||
--env=MOZ_DISABLE_RDD_SANDBOX=1 \ | ||
--env=NVD_BACKEND=direct \ | ||
--env=MOZ_ENABLE_WAYLAND=1 \ | ||
org.mozilla.firefox | ||
else | ||
echo 'The Nvidia kernel module is not loaded. You may be using secure boot without the needed signing key, lacking the needed kargs, or may not be on a Nvidia image. See "just enroll-secure-boot-key" and "just nvidia-set-kargs".' | ||
bold=$(tput bold) | ||
normal=$(tput sgr0) | ||
echo "${bold}Configuring Nvidia drivers${normal}" | ||
echo 'What would you like to do?' | ||
OPTION=$(ugum choose "Set needed kernel arguments" "Test CUDA support" "Enable Nvidia VAAPI in Firefox Flatpak") | ||
if [ "$OPTION" == "Set needed kernel arguments" ]; then | ||
if command -v nvidia-smi; then | ||
rpm-ostree kargs \ | ||
--append-if-missing=rd.driver.blacklist=nouveau \ | ||
--append-if-missing=modprobe.blacklist=nouveau \ | ||
--append-if-missing=nvidia-drm.modeset=1 \ | ||
--delete-if-present=nomodeset | ||
else | ||
echo 'You do not appear to be on a Nvidia image, please refer to the README for your uBlue-OS image.' | ||
fi | ||
elif [ "$OPTION" == "Test CUDA support" ]; then | ||
if lsmod | grep -wq "nvidia"; then | ||
podman run \ | ||
--user 1000:1000 \ | ||
--security-opt=no-new-privileges \ | ||
--cap-drop=ALL \ | ||
--security-opt label=type:nvidia_container_t \ | ||
--device=nvidia.com/gpu=all \ | ||
docker.io/nvidia/samples:vectoradd-cuda11.2.1 | ||
else | ||
echo 'The Nvidia kernel module is not loaded. You may be using secure boot without the needed signing key, lacking the needed kargs, or may not be on a Nvidia image. See "just enroll-secure-boot-key" and "just nvidia-set-kargs".' | ||
fi | ||
elif [ "$OPTION" == "Enable Nvidia VAAPI in Firefox Flatpak" ]; then | ||
if lsmod | grep -wq "nvidia"; then | ||
flatpak override \ | ||
--user \ | ||
--filesystem=host-os \ | ||
--env=LIBVA_DRIVER_NAME=nvidia \ | ||
--env=LIBVA_DRIVERS_PATH=/run/host/usr/lib64/dri \ | ||
--env=LIBVA_MESSAGING_LEVEL=1 \ | ||
--env=MOZ_DISABLE_RDD_SANDBOX=1 \ | ||
--env=NVD_BACKEND=direct \ | ||
--env=MOZ_ENABLE_WAYLAND=1 \ | ||
org.mozilla.firefox | ||
else | ||
echo 'The Nvidia kernel module is not loaded. You may be using secure boot without the needed signing key, lacking the needed kargs, or may not be on a Nvidia image. See "just enroll-secure-boot-key" and "just nvidia-set-kargs".' | ||
fi | ||
fi |