PortValhalla/scripts/Common/Software/nvidia-dkms/main.fish

35 lines
1.1 KiB
Fish
Executable file

#!/bin/env fish
begin
set -l dir (status dirname)
source "$dir/../../Scripts/software.fish"
function configureSW -V dir
set -l indicator "GRUB_CMDLINE_LINUX_DEFAULT=\""
set -l config "nvidia_drm.fbdev=1"
# According to: https://wiki.archlinux.org/title/NVIDIA/Tips_and_tricks
begin
printf %s\n \
"options nvidia NVreg_PreserveVideoMemoryAllocations=1" \
"options nvidia NVreg_TemporaryFilePath=/var/tmp"
end | sudo tee /etc/modprobe.d/nvidia-power-management.conf >/dev/null
sudo systemctl enable \
nvidia-suspend.service \
nvidia-hibernate.service \
nvidia-resume.service
if ! cat /etc/default/grub | grep "$indicator.*$config" >/dev/null
sudo sed -i /etc/default/grub \
-e "/$indicator/{" \
-e "s/\($indicator.*[^ ]\)\(\"\)/\1 \2/" \
-e "s/\($indicator.*\)\(\"\)/\1$config\2/" \
-e "}"
fish "$dir/../grub/main.fish" configure
end
end
runInstaller $argv
end