# Update fedora

dnf upgrade --refresh


# install repos
sudo dnf install https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-43.noarch.rpm https://mirrors.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-43.noarch.rpm
dnf install kernel-devel-$(uname -r) kernel-headers-$(uname -r)

# install drivers
dnf install akmod-nvidia xorg-x11-drv-nvidia-cuda

# tell nouveau to fuck right off a cliff you stupid mother fucking piece of fucking shit.
echo "blacklist nouveau" | sudo tee /etc/modprobe.d/blacklist-nouveau.conf
echo "options nouveau modeset=0" | sudo tee -a /etc/modprobe.d/blacklist-nouveau.conf
echo "options nvidia-drm modeset=1" | sudo tee /etc/modprobe.d/nvidia-kms.conf

# regen initramfs to purge it
dracut --force

# build NV kernel modules
akmods --force

#check for modules
ls /usr/lib/modules/$(uname -r)/extra/nvidia

# snapshot if you use a good file system, otherwise good luck.
zfs snapshot -r zroot@NVIDIA
reboot

# verify vulkan is happy
sudo dnf install vulkan-tools
vulkaninfo | grep -i "gpu\|device"
      
# make sure variable refresh works
$ gsettings get org.gnome.mutter experimental-features
$ gsettings set org.gnome.mutter experimental-features "['variable-refresh-rate']"


#power:

cat /sys/bus/pci/devices/*/power/control
# look for 'auto', you're good if you have it. if not:
echo auto | sudo tee /sys/bus/pci/devices/0000:01:00.0/power/control
vim /etc/udev/rules.d/80-nvidia-pm.rules # add:
ACTION=="add", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{power/control}="auto"
# reboot.

# 
