Boot into Text caused by services.xserver.videoDrivers = ["nvidia"]

Hey all, I’m trying to set up my new build to use the GPU for the display output instead of the built-in display of the motherboard and I can’t seem to get it to work. That is to say that when I plug in a display port or HDMI cable from my GPU to a monitor, no input is detected from the monitor. When I connect the monitor to the mobo’s built-in display port or HDMI, it works fine.

I’ve followed the Nvidia setup documentation including the Boot to Text section in the manual. However, when run sudo nixos-rebuild boot and then sudo reboot, it boots into a screen with a cursor in the top left. I can switch to another tty to get a login screen where I can login and edit the configuration.nix file.

What I’ve been able to do is to isolate the line in the title, this one:

  services.xserver.videoDrivers = [ "nvidia" ];

to be the line that is causing the problem. When I have that line commented out, the GUI starts fine (I’m using Plasma). When I uncomment the line, I get that hanging boot.

For diagnosis, my system is this (note the 4070 TI is found as a device by the OS):

OS: NixOS 23.05.3376.4c8cf44c5b94 (Stoat) x86_64 
Kernel: 6.1.51 
Uptime: 11 hours, 20 mins 
Packages: 1029 (nix-system), 566 (nix-user) 
Shell: bash 5.2.15 
Resolution: 3840x2160 
DE: Plasma 
WM: KWin 
Icons: kora [GTK2/3] 
Terminal: .konsole-wrappe 
CPU: AMD Ryzen 9 7950X3D (32) @ 4.200GHz 
GPU: AMD ATI Raphael 
GPU: NVIDIA GeForce RTX 4070 Ti 
Memory: 5428MiB / 127956MiB 

And the log output of the last failing boot (journalctl -b -1) can be found on pastebin here. My configuration.nix file is on pastebin here