diff --git a/core/tabs/system-setup/arch/nvidia-drivers.sh b/core/tabs/system-setup/arch/nvidia-drivers.sh index 2f573712..30964fe2 100755 --- a/core/tabs/system-setup/arch/nvidia-drivers.sh +++ b/core/tabs/system-setup/arch/nvidia-drivers.sh @@ -14,15 +14,15 @@ installDeps() { printf "%b\n" "${CYAN}Installing headers for $kernel...${RC}" "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm "$header" done - } checkHardware() { + # Refer https://nouveau.freedesktop.org/CodeNames.html for model code names model=$(lspci -k | grep -A 2 -E "(VGA|3D)" | grep controller | cut -d ' ' -f 7 | cut -c 1-2 ) case "$model" in GM|GP|GV) return 1 ;; TU|GA|AD) return 0 ;; - *) printf "%b\n" "${RED}Your hardware is not supported." && exit 1 ;; + *) printf "%b\n" "${RED}Unsupported hardware." && exit 1 ;; esac } @@ -40,13 +40,18 @@ enableNvidiaModeset() { else "$ESCALATION_TOOL" sed -i "/^GRUB_CMDLINE_LINUX_DEFAULT=/ s/\"$/ $PARAMETER\"/" /etc/default/grub printf "%b\n" "${CYAN}Added $PARAMETER to /etc/default/grub.${RC}" - "$ESCALATION_TOOL" grub-mkconfig -o /boot/grub/grub.cfg fi } -setupHardwareAccelration() { +setupHardwareAcceleration() { + if ! command_exists grub-mkconfig; then + printf "%b\n" "${RED}Currently hardware acceleration is only available with GRUB.${RC}" + return; + fi + modeset=$("$ESCALATION_TOOL" cat /sys/module/nvidia_drm/parameters/modeset) + if [ ! "$modeset" = "Y" ]; then enableNvidiaModeset fi @@ -70,18 +75,19 @@ setupHardwareAccelration() { printf "LIBVA_DRIVER_NAME=nvidia\nMOZ_DISABLE_RDD_SANDBOX=1" | "$ESCALATION_TOOL" tee -a /etc/environment > /dev/null - printf "%b\n" "${GREEN}Hardware Accelration setup completed successfully.${RC}" + printf "%b\n" "${GREEN}Hardware Acceleration setup completed successfully.${RC}" - if promptUser "enable hardware accelration in mpv player"; then + if promptUser "enable hardware Acceleration in mpv player"; then if [ -f "$HOME/.config/mpv/mpv.conf" ];then sed -i '/^hwdec/d' "$HOME/.config/mpv/mpv.conf" fi printf "hwdec=auto" | tee -a "$HOME/.config/mpv/mpv.conf" > /dev/null - printf "%b\n" "${GREEN}MPV Hardware Accelration enabled successfully.${RC}" + printf "%b\n" "${GREEN}MPV Hardware Acceleration enabled successfully.${RC}" fi } installDriver() { + # Refer https://wiki.archlinux.org/title/NVIDIA for open-dkms or dkms driver selection if checkHardware && promptUser "install nvidia's open source drivers"; then printf "%b\n" "${YELLOW}Installing nvidia open source driver...${RC}" installDeps @@ -92,13 +98,9 @@ installDriver() { "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm nvidia-dkms fi - if echo "$XDG_CURRENT_DESKTOP" | grep -q "GNOME"; then - "$ESCALATION_TOOL" systemctl enable nvidia-suspend.service nvidia-hibernate.service nvidia-resume.service - fi - printf "%b\n" "${GREEN}Driver installed successfully.${RC}" - if command_exists grub-mkconfig && promptUser "setup hardware accelration"; then - setupHardwareAccelration + if promptUser "setup hardware Acceleration"; then + setupHardwareAcceleration fi printf "%b\n" "${GREEN}Please reboot your system for the changes to take effect.${RC}" diff --git a/core/tabs/system-setup/tab_data.toml b/core/tabs/system-setup/tab_data.toml index 0ecf8ed1..b237bbf4 100644 --- a/core/tabs/system-setup/tab_data.toml +++ b/core/tabs/system-setup/tab_data.toml @@ -16,10 +16,10 @@ script = "arch/server-setup.sh" task_list = "SI D" [[data.entries]] -name = "Nvidia Drivers && Hardware Accelration" -description = "This script installs and configures nvidia drivers with Hardware Accelration." +name = "Nvidia Drivers && Hardware Acceleration" +description = "This script installs and configures nvidia drivers with Hardware Acceleration." script = "arch/nvidia-drivers.sh" -task_list = "I FM RP SS" +task_list = "I FM" [[data.entries]] name = "Paru AUR Helper" diff --git a/docs/userguide.md b/docs/userguide.md index 7010ae6e..499681f1 100644 --- a/docs/userguide.md +++ b/docs/userguide.md @@ -101,7 +101,7 @@ For more information visit: https://christitus.com/linux-security-mistakes ### Arch Linux - **Arch Server Setup**: This command installs a minimal arch server setup under 5 minutes. -- **Nvidia Drivers && Hardware Accelration**: This script installs and configures nvidia drivers with Hardware Accelration. +- **Nvidia Drivers && Hardware Acceleration**: This script installs and configures nvidia drivers with Hardware Acceleration. - **Paru AUR Helper**: Paru is your standard pacman wrapping AUR helper with lots of features and minimal interaction. To know more about AUR helpers visit: https://wiki.archlinux.org/title/AUR_helpers - **Yay AUR Helper**: Yet Another Yogurt - An AUR Helper Written in Go.