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

35 lines
1.1 KiB
Fish
Raw Normal View History

2024-09-20 00:01:22 +00:00
#!/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"
2024-10-06 19:25:34 +00:00
end | sudo tee /etc/modprobe.d/nvidia-power-management.conf >/dev/null
2024-09-20 00:01:22 +00:00
sudo systemctl enable \
nvidia-suspend.service \
nvidia-hibernate.service \
nvidia-resume.service
2024-10-06 19:25:34 +00:00
if ! cat /etc/default/grub | grep "$indicator.*$config" >/dev/null
2024-09-20 00:01:22 +00:00
sudo sed -i /etc/default/grub \
-e "/$indicator/{" \
-e "s/\($indicator.*[^ ]\)\(\"\)/\1 \2/" \
-e "s/\($indicator.*\)\(\"\)/\1$config\2/" \
-e "}"
2024-10-13 13:35:24 +00:00
fish "$dir/../grub/main.fish" configure
2024-09-20 00:01:22 +00:00
end
end
runInstaller $argv
end