[Prime - nvidia primary mode] Xorg fail to start when external monitor is plugged in the nvidia gpu

I have a nvidia 3070 & amd igpu hybrid laptop. i wanted to have it run in nvidia only mode.
i had a lot of problems configuring xorg because my screen wasn’t turning on and as soon as i unpluged my only display wired to the nvidia gpu the integrated and my hdmi monitor began working.

if xorg tries to start with the screen wired on the nvidia gpu it crashes instantly.

When i plug the screen in i get this log in .local/share/xorg/Xorg.0.log

[  1036.887] (EE) event16 - Logitech G512 RGB MECHANICAL GAMING KEYBOARD: client bug: event processing lagging behind by 30ms, your system is too slow
[  1310.792] (EE) NVIDIA(GPU-0): Unable to add conservative default mode "nvidia-auto-select".
[  1310.792] (EE) NVIDIA(GPU-0): Unable to add "nvidia-auto-select" mode to ModePool.
[  1310.793] (--) NVIDIA(GPU-0): Acer VG240Y V (DFP-0): connected
[  1310.793] (--) NVIDIA(GPU-0): Acer VG240Y V (DFP-0): Internal DisplayPort
[  1310.793] (--) NVIDIA(GPU-0): Acer VG240Y V (DFP-0): 2670.0 MHz maximum pixel clock
[  1310.793] (--) NVIDIA(GPU-0): 
[  1310.799] (--) NVIDIA(GPU-0): Acer VG240Y V (DFP-0): connected
[  1310.799] (--) NVIDIA(GPU-0): Acer VG240Y V (DFP-0): Internal DisplayPort
[  1310.799] (--) NVIDIA(GPU-0): Acer VG240Y V (DFP-0): 2670.0 MHz maximum pixel clock
[  1310.799] (--) NVIDIA(GPU-0): 
[  1310.802] (--) NVIDIA(GPU-0): DFP-1: disconnected
[  1310.802] (--) NVIDIA(GPU-0): DFP-1: Internal TMDS
[  1310.802] (--) NVIDIA(GPU-0): DFP-1: 165.0 MHz maximum pixel clock
[  1310.802] (--) NVIDIA(GPU-0): 
[  1310.802] (--) NVIDIA(GPU-0): Acer VG240Y V (DFP-0): connected
[  1310.802] (--) NVIDIA(GPU-0): Acer VG240Y V (DFP-0): Internal DisplayPort
[  1310.802] (--) NVIDIA(GPU-0): Acer VG240Y V (DFP-0): 2670.0 MHz maximum pixel clock
[  1310.802] (--) NVIDIA(GPU-0): 
[  1310.804] (--) NVIDIA(GPU-0): DFP-1: disconnected
[  1310.804] (--) NVIDIA(GPU-0): DFP-1: Internal TMDS
[  1310.804] (--) NVIDIA(GPU-0): DFP-1: 165.0 MHz maximum pixel clock
[  1310.804] (--) NVIDIA(GPU-0): 

Xorg.conf

Section "OutputClass"
    Identifier "AMD"
    MatchDriver "amdgpu"
    Driver "amdgpu"
EndSection

Section "OutputClass"
    Identifier "nvidia"
    MatchDriver "nvidia-drm"
    Driver "nvidia"
    Option "AllowEmptyInitialConfiguration"
    Option "PrimaryGPU" "yes"
    ModulePath "/usr/lib/nvidia/xorg"
    ModulePath "/usr/lib/xorg/modules"
EndSection

nvidia-bug-report.log.gz (846.1 KB)

I changed my xorg config for this

Section "ServerLayout"
        Identifier "layout"
        Option "AllowNVIDIAGPUScreens"
EndSection

Section "Device"
    Identifier     "Device0"
    Driver         "nvidia"
    VendorName     "NVIDIA Corporation"
    BusID          "PCI:1:0:0"
EndSection

Section "Device"
    Identifier     "Device1"
    Driver         "modesetting"
    BusID          "PCI:6:0:0"
EndSection

Section "OutputClass"
    Identifier "Device1"
    MatchDriver "amdgpu"
    Driver "modesetting"
EndSection

Section "OutputClass"
    Identifier "Device0"
    MatchDriver "nvidia-drm"
    Driver "nvidia"
    Option "AllowEmptyInitialConfiguration"
    Option "PrimaryGPU" "yes"
    ModulePath "/usr/lib/nvidia/xorg"
    ModulePath "/usr/lib/xorg/modules"
EndSection

Running xrandr --setprovideroutputsource modesetting NVIDIA-0 && xrandr --auto give this error:

xrandr: Output DP-0 is not disconnected but has no modes
xrandr: cannot find preferred mode

Turns out my screen crashed after unplugging the power and plugging it back in i began working