mirror of
https://github.com/basecamp/omarchy.git
synced 2025-07-27 04:09:23 +00:00
@ -27,10 +27,6 @@ source = ~/.config/omarchy/current/theme/hyprland.conf
|
||||
# Extra env variables
|
||||
env = GDK_SCALE,2 # Change to 1 if on a 1x display
|
||||
|
||||
# Extra env variables needed if running an NVIDIA GPU
|
||||
# env = NVD_BACKEND,direct
|
||||
# env = LIBVA_DRIVER_NAME,nvidia
|
||||
# env = __GLX_VENDOR_LIBRARY_NAME,nvidia
|
||||
|
||||
# Extra bindings
|
||||
bind = SUPER, A, exec, $webapp="https://chatgpt.com"
|
||||
|
@ -4,4 +4,4 @@ yay -S --noconfirm --needed \
|
||||
xdg-desktop-portal-hyprland xdg-desktop-portal-gtk
|
||||
|
||||
# Start Hyprland on first session
|
||||
echo "[[ -z \$DISPLAY && \$(tty) == /dev/tty1 ]] && exec Hyprland" >~/.bash_profile
|
||||
echo "[[ -z \$DISPLAY && \$(tty) == /dev/tty1 ]] && exec Hyprland" >~/.bash_profile
|
86
install/nvidia.sh
Normal file
86
install/nvidia.sh
Normal file
@ -0,0 +1,86 @@
|
||||
# ==============================================================================
|
||||
# Hyprland NVIDIA Setup Script for Arch Linux
|
||||
# ==============================================================================
|
||||
# This script automates the installation and configuration of NVIDIA drivers
|
||||
# for use with Hyprland on Arch Linux, following the official Hyprland wiki.
|
||||
#
|
||||
# Author: https://github.com/Kn0ax
|
||||
#
|
||||
# ==============================================================================
|
||||
|
||||
# --- GPU Detection ---
|
||||
# Check if nvidia gpu exists, exit silently if not found
|
||||
gpu_info=$(lspci | grep -i 'nvidia')
|
||||
if [ -z "$gpu_info" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# --- Driver Selection ---
|
||||
# Turing (16xx, 20xx), Ampere (30xx), Ada (40xx), and newer recommend the open-source kernel modules
|
||||
if echo "$gpu_info" | grep -q -E "RTX [2-9][0-9]|GTX 16"; then
|
||||
NVIDIA_DRIVER_PACKAGE="nvidia-open-dkms"
|
||||
else
|
||||
NVIDIA_DRIVER_PACKAGE="nvidia-dkms"
|
||||
fi
|
||||
|
||||
# Check which kernel is installed and set appropriate headers package
|
||||
KERNEL_HEADERS="linux-headers" # Default
|
||||
if pacman -Q linux-zen &>/dev/null; then
|
||||
KERNEL_HEADERS="linux-zen-headers"
|
||||
elif pacman -Q linux-lts &>/dev/null; then
|
||||
KERNEL_HEADERS="linux-lts-headers"
|
||||
elif pacman -Q linux-hardened &>/dev/null; then
|
||||
KERNEL_HEADERS="linux-hardened-headers"
|
||||
fi
|
||||
|
||||
# Enable multilib repository for 32-bit libraries
|
||||
if ! grep -q "^\[multilib\]" /etc/pacman.conf; then
|
||||
sudo sed -i '/^#\[multilib\]/,/^#Include/ s/^#//' /etc/pacman.conf
|
||||
fi
|
||||
|
||||
# Install packages
|
||||
PACKAGES_TO_INSTALL=(
|
||||
"${KERNEL_HEADERS}"
|
||||
"${NVIDIA_DRIVER_PACKAGE}"
|
||||
"nvidia-utils"
|
||||
"lib32-nvidia-utils"
|
||||
"egl-wayland"
|
||||
"libva-nvidia-driver" # For VA-API hardware acceleration
|
||||
"qt5-wayland"
|
||||
"qt6-wayland"
|
||||
)
|
||||
|
||||
yay -Syu --needed --noconfirm "${PACKAGES_TO_INSTALL[@]}"
|
||||
|
||||
# Configure modprobe for early KMS
|
||||
echo "options nvidia_drm modeset=1" | sudo tee /etc/modprobe.d/nvidia.conf >/dev/null
|
||||
|
||||
# Configure mkinitcpio for early loading
|
||||
MKINITCPIO_CONF="/etc/mkinitcpio.conf"
|
||||
|
||||
# Define modules
|
||||
NVIDIA_MODULES="nvidia nvidia_modeset nvidia_uvm nvidia_drm"
|
||||
|
||||
# Create backup
|
||||
sudo cp "$MKINITCPIO_CONF" "${MKINITCPIO_CONF}.backup"
|
||||
|
||||
# Remove any old nvidia modules to prevent duplicates
|
||||
sudo sed -i -E 's/ nvidia_drm//g; s/ nvidia_uvm//g; s/ nvidia_modeset//g; s/ nvidia//g;' "$MKINITCPIO_CONF"
|
||||
# Add the new modules at the start of the MODULES array
|
||||
sudo sed -i -E "s/^(MODULES=\\()/\\1${NVIDIA_MODULES} /" "$MKINITCPIO_CONF"
|
||||
# Clean up potential double spaces
|
||||
sudo sed -i -E 's/ +/ /g' "$MKINITCPIO_CONF"
|
||||
|
||||
sudo mkinitcpio -P
|
||||
|
||||
# Add NVIDIA environment variables to hyprland.conf
|
||||
HYPRLAND_CONF="$HOME/.config/hypr/hyprland.conf"
|
||||
if [ -f "$HYPRLAND_CONF" ]; then
|
||||
cat >> "$HYPRLAND_CONF" << 'EOF'
|
||||
|
||||
# NVIDIA environment variables
|
||||
env = NVD_BACKEND,direct
|
||||
env = LIBVA_DRIVER_NAME,nvidia
|
||||
env = __GLX_VENDOR_LIBRARY_NAME,nvidia
|
||||
EOF
|
||||
fi
|
Reference in New Issue
Block a user