I used this method to install the nvidia drivers on Debian. I have the driver version 580.105 installed, newer drivers are causing bugs for me. The repository contains pinning packages to stay on a certain driver version.
wget https://developer.download.nvidia.com/compute/cuda/repos/debian12/x86_64/cuda-keyring_1.1-1_all.deb
sudo dpkg -i cuda-keyring_1.1-1_all.deb
sudo apt update
sudo apt install nvidia-driver-pinning-580.105.0
sudo apt update
sudo apt install linux-headers-amd64
sudo apt install nvidia-driver
https://docs.nvidia.com/datacenter/tesla/driver-installation-guide/debian.html